C Program To Subtract Two Numbers
♣ Try it Out ::
#include<stdio.h> #include<conio.h> int main() { // code for integers int a, b, sub1; printf("\nEnter two Integers: "); scanf("%d %d", &a, &b); sub1 = a - b; printf("sub1 is: %d - %d = %d\n", a, b, sub1); // code for floating numbers float c, d, sub2; printf("\nEnter two Floating numbers: "); scanf("%f %f", &c, &d); sub2 = c - d; printf("sub2 is: %.2f - %.2f = %.2f\n", c, d, sub2); getch(); return(0); }
♣ Output ::
Enter two Integers: 100 45 sub1 is: 100 - 45 = 55 Enter two Floating numbers: 12 5.3 sub2 is: 12.00 - 5.30 = 6.70
♣ Downloads ::
Comments
Post a Comment