With basic knowledge on input-output function of C. We can now perform simple arithmetic programs, like in this example Subtraction Program.
Source Code:
#include<stdio.h>
main()
{
int num1, num2, diff;
clrscr();
printf("Enter two numbers to perform Subtraction:");
scanf("%d %d", &num1, &num2);
diff=num1-num2;
printf("The difference of two numbers is: %d",diff);
getch();
}
Output of the Program:
Source Code:
#include<stdio.h>
main()
{
int num1, num2, diff;
clrscr();
printf("Enter two numbers to perform Subtraction:");
scanf("%d %d", &num1, &num2);
diff=num1-num2;
printf("The difference of two numbers is: %d",diff);
getch();
}
Output of the Program:
0 comments :
Post a Comment