-
Language
C
-
Description
It takes two numbers from the keyboard and subtracts the smaller number from the larger one.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
float a, b, difference;
printf ("Enter the value of a: ");
scanf ("%f", &a);
(void) getchar ();
printf ("Enter the value of b: ");
scanf ("%f", &b);
(void) getchar ();
if(a>b)
difference=a-b;
else
difference=b-a;
printf ("Value of difference: %g\n", difference);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}
#include <stdlib.h>
int main (void)
{
float a, b, difference;
printf ("Enter the value of a: ");
scanf ("%f", &a);
(void) getchar ();
printf ("Enter the value of b: ");
scanf ("%f", &b);
(void) getchar ();
if(a>b)
difference=a-b;
else
difference=b-a;
printf ("Value of difference: %g\n", difference);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}