Description
This program is used to add two numbers. The first number is read as input from the user and stored in the variable a, and the second number is stored in the variable b. The statement c=a+b; adds the two numbers and stores the result in the variable c. The statement printf("Sum is %d",c); prints the result to the output screen.
Program
// add two numbers c #include<stdio.h> #include<conio.h> void main() { int a,b,c; printf("Enter the first number: "); scanf("%d",&a); printf("Enter the second number: "); scanf("%d",&b); c=a+b; printf("Sum is %d",c); getch(); }
Output
C program to add 2 numbers |
No comments:
Post a Comment