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

please help......
Posted by aleko 1 Sep 2010 15:14
            int a, b, c;
            a=Console.Read();
            b = Console.Read();
            c = a + b;
            Console.Write(c);

what is there wrong?
Re: please help......
Posted by Andrew Hoffmann aka SKYDOS [Vladimir SU] 1 Sep 2010 18:23
int[] nums=Console.ReadLine().Split(new char[]{'\n','\t',' '}, StringSplitOptions.RemoveEmptyEntries).Select(s=> int.Parse(s)).ToArray();
Console.WriteLine(nums[0]+nums[1]);

go and learn C#

Edited by author 01.09.2010 19:13
Re: please help......
Posted by aleko 2 Sep 2010 16:40
Is not any easier way?

Edited by author 02.09.2010 17:33

Edited by author 02.09.2010 17:33
Re: please help......
Паскаль рулит :)
Re: please help......
Posted by RujinCao 11 Sep 2010 19:31
I highly recommend you to read some C# tutorials.
Here is a good start:
http://msdn.microsoft.com/en-us/library/67ef8sbd.aspx

PS: Console.Read can only read the next character from input stream.See more information at:
http://msdn.microsoft.com/en-us/library/system.console.read.aspx
Re: please help......
Posted by HUMOYUN_220-10 13 Oct 2010 14:30
aleko wrote 1 September 2010 15:14
            int a, b, c;
            a=Console.Read();
            b = Console.Read();
            c = a + b;
            Console.Write(c);

what is there wrong?
Re: please help......
Posted by xerxe 29 Dec 2010 04:19
There is a short way of writing that:

String[] s;
s = Console.ReadLine().Split();
Console.WriteLine(int.Parse(s[0])+int.Parse(s[1]));