C Program to Add Two Numbers

Here you will get simple C program to add two numbers.

User will input two numbers, then their sum will be calculated and finally it will be printed on screen.

The program is given below.

C Program to Add Two Numbers 

#include<stdio.h>

int main()
{
	int a,b,sum;

	printf("Enter first number:");
	scanf("%d",&a);

	printf("Enter second number:");
	scanf("%d",&b);

	sum=a+b;
	printf("\nSum=%d",sum);

	return 0;	
}

 

 

Output

Enter first number:4
Enter second number:8

Sum=12

2 thoughts on “C Program to Add Two Numbers”

Leave a Comment

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