Add or Subtract two or more than two Integers in C-Sharp:- In the above-given video, I have shown that how to add two or more than two integers can be added or subtracted by hard coding or taking input from the user. So in this article, I am going to show you step by step:- Adding the Values:- Step1: First of all, All you had to do is to take two integers and variables and an extra variable for saving the value that comes by adding the two variables (a and b). using the hard-code method (hard-code method means setting the values of variables) int a=5,b=10,c; Step2: And now I am going to use the formula for adding the values of the variables. c=a+b; Step3: Now I am going to save the answer in variable c. Console.Write("The answer is = {0}",c); Step4: Use Console.ReadKey to hold the result or answer. Console.ReadKey(); Step5: Press F5 or the Start button. Output: And now, I am going to show how to
Posts
Showing posts from December, 2018