int num1 = 10, num2 = 5;
num1 - = num2 ;//num1 = num1 - num2
Console.WriteLine("Addition is {0}",num1);
How come it shows num1 value = 10 as output
Plz help...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Sep 17, 2013, 5:28 AM
in your code:
step 1
using System;
class Class3
{
static void Main()
{
int num1 = 10, num2 = 5;// initialise the value of num1 to 10 and num2 to 5
num1 -=num2;// here it will substract num1 with num2 and assign it to num1. the new value is 5
Console.WriteLine("Addition is {0}",num1); // it will print the num1 value.
Console.ReadLine();
}
}
Output: 5