C Program to Add Two Numbers Given by User and Display Sum


#include<stdio.h>
#include<conio.h>

int main()
{
	int a, b, sum; /* Variables Declaration */
	printf("Enter the value of a: ");
	scanf("%d", &a); /* Reading First Number */
	printf("Enter the value of b: ");
	scanf("%d", &b); /* Reading Second Number */
	sum = a + b; /* Finding Sum */
	printf("Sum of %d and %d is %d.",a,b,sum);
	getch(); /* Holds the output */
	return 0;
}
--------------------------------------------------
Note: If you are using compiler other than Turbo C then you do not need clrscr(), getch() and #include<conio.h>
 Output of the above program :
Enter the value of a: 13 ↲
Enter the value of b: 33 ↲
Sum of 13 and 33 is 46.

Note: ↲ indicates ENTER is pressed.

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.