|
|
back to boardWhat's wrong? Posted by Eugene 5 Jul 2012 02:36 Help. What's wrong in this code? using System; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int N, A, B; do { Console.Write("ВВедите N: "); N = int.Parse(Console.ReadLine()); } while (N < 1 || N > 100); do { A = int.Parse(Console.ReadLine()); } while (A < 1 || A > 100); do { B = int.Parse(Console.ReadLine()); } while (B < 1 || B > 100);
int R = ((A*B) * 2)*N; Console.WriteLine(R); } } } Re: What's wrong? Posted by Noob 5 Jul 2012 02:39 > Console.Write("ВВедите N: "); Delete this line. You should not output anything except the answer. Just think how the system can check it otherwise? Re: What's wrong? Posted by Eugene 5 Jul 2012 04:01 I deleted that line, but I still get the Crash on the first test((( Re: What's wrong? All three numbers are given in the same line. So, when you try to parse it as a single number, it crashes. |
|
|