You will write a program that uses compound assignment in connection with adding, subtraction, multiplication, and division.
The program works with the same variable every time!
The division here is integer division since both number and 2 are ints.
using System; class Program/* w ww . ja v a2s . c o m*/ { static void Main(string[] args) { // Input Console.Write("Enter a number: "); string input = Console.ReadLine(); int number = Convert.ToInt32(input); // Calculation using compound assignment number += 10; // same as number = number + 10; // Result output Console.WriteLine("Number ten more greater is: " + number); // With subtraction number -= 5; // same as number = number - 5; Console.WriteLine("After decrease by 5: " + number); // With multiplication number *= 10; // same as number = number * 10; Console.WriteLine("Ten times greater: " + number); // With division number /= 2; // same as number = number / 2; Console.WriteLine("Decreased to one half: " + number); } }