Write a program to subtract two numbers.
Answers
Answer:
Algorithm to subtract two numbers in C:
1) Start
2) Accept Number one
3) Accept Number two
4) Subtract both the numbers
5) Print the result.
6) End
Program to subtract two numbers in C:
C/C++
27 lines
/*Program to subtract two numbers in C.
Programmer: Harsh Shah, Date: 29/6/13*/
#include<stdio.h>
#include<conio.h>
void main(){
int one, two, sub;
printf("Enter first number - ");
scanf("%d",&one);
printf("Enter second number - ");
scanf("%d",&two);
sub = one - two;
printf("The subtraction of numbers %d and %d is %d",one,two,sub);
getch();
}
//End of the program.
Output:
Enter first number – 22
Enter second number – 11
The subtraction of numbers 22 and 11 is 11
So this was, the program to subtract two numbers in C.
Answer:
Program to subtract two numbers in C:
h> #include<conio. h> void main(){ int one, two, sub; printf("Enter first number - "); scanf("%d",&one); printf("Enter second number - "); scanf("%d",&two); sub = one - two; printf("The subtraction of numbers %d and %d is %d",one,two,sub); getch(); } //End of the program.