This is the program that takes two numbers as input from the user and then add them and print the answer on the output screen.
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int num1,num2;
int answer;
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number= ");
scanf("%d",&num2);
answer=num1+num2; //here we make a formula for variable "answer"
printf("\n The sum of numbers = %d",answer);
getch();
}
Output:-
Enter the first number = 5
Enter the second number= 15
The sum of numbers = 20
No comments:
Post a Comment