ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

C# - Why wrong answer???
Posted by Alexandr 13 Oct 2008 22:19
using System;
public class Program
    {
        public static void Main(string[] args)
        {
            int a, b;
            int.TryParse(Console.ReadLine(), out a);
            int.TryParse(Console.ReadLine(), out b);
            Console.WriteLine("{0}", a + b);
        }
    }
//It work perfect on my VisualStudio 2008

Edited by author 13.10.2008 22:24
Re: C# - Why wrong answer???
Posted by Igor Goroshko 13 Oct 2008 23:12
numbers are located on the same line!
So you should read Data in this way:

string[] nums = Console.ReadLine().Split(' ');
int a = int.Parse(nums[0]);
int b = int.Parse(nums[1]);

Console.WriteLine(a+b);