Firstly, I do not have much experience with C #, I just know programming logic. I'm studying C # out of curiosity, it's a language that has always interested me.
I am studying through the URI and I am not able to solve this exercise:
Read 4 integer values A, B, C, and D. Then if B is greater than C and if D is greater than A, and the sum of C with D is greater than the sum of A and B and if C and D are both positive and if variable A is even write the message "Values accepted", otherwise write "Values not accepted. "
The code I run in Visual Studio works fine, but when I send it to the URI it gives the error:
Runtime error
The code looks like this:
using System;
class URI {
static void Main(string[] args) {
int a, b, c, d;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
c = int.Parse(Console.ReadLine());
d = int.Parse(Console.ReadLine());
if ( (b > c) && (d > a) && ((c + d) > (a + b)) && (c > 0 && d > 0) && (a % 2 == 0)) {
Console.WriteLine("Valores aceitos");
} else {
Console.WriteLine("Valores nao aceitos");
}
}
}