Click here to Upload your own logic for this program.

Adding two numbers Program(By taking user input)


Program:


#include<stdio.h> main() { int x,y,z; printf("Enter the first number: "); scanf("%d",&x); printf("\n"); printf("Enter the second number: "); scanf("%d", &y); printf("\n"); z=x+y; printf("Sum of the two numbers is: %d", z); }
Output:
		

Enter the first number: 4 Enter the second number: 5 Sum of the two numbers is: 9


Program:


#include main() //Without using third variable { int adi,shek; printf("Enter any two numbers:-"); scanf("%d%d",&adi,&shek); printf("Sum=%d ",adi+shek); }
Output:
		

Enter any two number:- 5 7 Sum=12