C program to add two numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int num1,num2,ans;
printf("Enter the value of num1 = ");
scanf("%d",&num1);
printf("\nEnter the value of num2 = ");
scanf("%d",&num2);
ans= num1 + num2;
printf("\nthe sum of two number is = %d",ans);
getch();
}
Sample Output:
Enter the value of num1 =5
Enter the value of num2 =44
the sum of two number is = 49
#include<conio.h>
void main()
{
int num1,num2,ans;
printf("Enter the value of num1 = ");
scanf("%d",&num1);
printf("\nEnter the value of num2 = ");
scanf("%d",&num2);
ans= num1 + num2;
printf("\nthe sum of two number is = %d",ans);
getch();
}
Sample Output:
Enter the value of num1 =5
Enter the value of num2 =44
the sum of two number is = 49
No comments:
Post a Comment