|  | 
|  | 
| back to board | C# - Why wrong answer??? 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??? 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);
 | 
 | 
|