C Program to Add Two Integer Number -- C Programs

In our previous tutorial, we had made a simple program of C language in which we had printed Hello World on the display. Hope you guyz understood that program. Now, today I am going to make another C program which takes the 2 input from the user in the numerical value and gives us the sum of these two numerical value.  So Let’s Begin…

C Program to Add Two Numerical Value. 


int main()


int A,B,C;

printf("Enter the value of A=");


printf("Enter the value of B=");



printf("Answer is=%d",c);



Output :- 

Look at the function used in the above code

1. In the first line of code we include a header file named <stdio.h> which is used to add the printf, scanf function in the program. 

2. On the second line of the code we use int main () function. It shows that your program starts executing from here. 

3. After that we declare 3 variable (A, B, C) respectively. The first variable A store the first numerical value and the second variable B store the second numerical value and the sum of these two number are stored on the third variable C. 

4. After the declaration of the variable we give the message to the user to enter the first number. We use printf() function to give the message which is printed on the monitor screen.

5. After the message the value provided by the user was stored in the first variable name A. we assign the value into A variable by using scanf() function. 

6. In scanf() function we use %d on it. %d indicates the compiler that the user gives an integer value to it.

7. You also notice that we use & (and) symbol on both scanf function what are their mean. The & symbol tell the compiler that the input given by the user is stored on the specific location. (The first value stored on A variable and the second value stored on B variable respectively).

8. At the last line of code we use a function name getch(). This function is used to hold the output screen until the user presses any button or click on the output screen. 

  • '+w+""+y+"
  • "}else{if(A==6){c+='
  • "+w+'
  • "}else{c+='
  • "+w+"
  • "}}}}}s.innerHTML=c+=""+y;d.callBack()};randomRelatedIndex=h;showRelatedPost=g;j(d.homePage.replace(/\/$/,"")+"/feeds/posts/summary"+e+"?alt=json-in-script&orderby=updated&max-results=0&callback=randomRelatedIndex")})(window,document,document.getElementsByTagName("head")[0]); //]]>

    1 comment:

    Like us on facebook

    blogger templatesblogger widgets

    Follow on Twitter



    Mad About Computer. Powered by Blogger.
    This site is in no way affiliated with or endorsed by specified business. It exists as a compendium of supporting information intended for informational purposes only. If you want to buy this website, please don't hesitate to contact us via e-mail: domain (dot) sales (dot) org @ gmail (dot) com or you can find and buy it on Afternic domain auctions.