If you want to add or sum any two numbers you can add by using c# language with the help of loop and mathematical operation only. For adding, you have to give any two numbers. Firstly user has to provide the first number and then the second number. And the sum of two numbers will be defined in the sum variable, which is defined in integer datatypes.
Steps are:
step 1: Get the number by user.
step 2: Get the modules/remainder of the number.
step 3: sum the remainder of the number
step 4: divide the number by 2.
step 3: sum the remainder of the number
step 4: divide the number by 2.
The syntax of the sum of two numbers is as follows:
int x = 0;
int y = 0;
int sum = x + y;
Console.WriteLine(sum);
In the preceding syntax,
The first number is defined in x, and the second number is defined in y. The addition of x and y is given in the sum variable which is defined in integer datatypes.
Comments