CSharp - Write program to Accumulate Values

Requirements

  • Read user input
  • Store the user input into a variable
  • Increase the value by 10 and save back to the same value

Hint

The core statement of the solution is:

number = number + 10;

Demo

using System;
class Program{//  w ww. j a 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  
        number = number + 10;

        // Result output 
        Console.WriteLine("Number ten more greater is: " + number);
    }
}

Result