Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
static void Main(string[] args)
{
int a =5;
int b =5;
int c;
Console.WriteLine(c = a-- - ++b);
Console.WriteLine(b);
Console.ReadLine();
}
a) -7,b) -5,c) -6,d),
The above code will return -1 on one line and 6 on the other line.
The expression c = a-- - ++b means we use the value of 'a' before decrementing thus '5' and subtract from b after incrementing by 1 thus '6'. So, c = 5 - 6 = -1
The next line we display the value of b
the answer will be printed -1 in first line and 6 in second line