Add two numbers in C?

In this section you will learn how to add two numbers in c in easy way. We are performing simple arithmetic operation on two numbers or addition of two numbers and then we will show the sum of two number on output screen. In this program we are taking the input from user.

Let’s suppose a user will input two numbers as '10' and '5' then as result 15 will be printed on the output screen.

How program will work?

Program of adding two numbers in c


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

	//ADDITION OF TWO NUMBERS PROGRAM:
	void main()
	{
		int a,b,c;
		clrscr();
	
		printf("ENTER THE FIRST NUMBER:- ");
		scanf("%d",&a);
		printf("ENTER THE SECOND NUMBER:- ");
		scanf("%d",&b);

		c=a+b;
		printf("RESULT OF TWO NUMBERS IS:- %d",c);

	getch();
	}

Output:


	ENTER THE FIRST NUMBER:- 10
	ENTER THE SECOND NUMBER:- 5
	RESULT OF TWO NUMBERS IS:- 15

Post Your Comment