-
Language
C
-
Description
It converts yards and feet to inches and add them together.
The program allows for the input of three numbers:
yards
feet
inches
Then take the yards and feet input converts them to inches and adds all three numbers together.
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)
{
int feet, inches, total_inches, yards;
printf ("Enter the value of feet: ");
scanf ("%d", &feet);
(void) getchar ();
printf ("Enter the value of inches: ");
scanf ("%d", &inches);
(void) getchar ();
printf ("Enter the value of yards: ");
scanf ("%d", &yards);
(void) getchar ();
total_inches=(yards*3+feet)*12+inches;
printf ("Value of total inches: %d\n", total_inches);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}
#include <stdlib.h>
int main (void)
{
int feet, inches, total_inches, yards;
printf ("Enter the value of feet: ");
scanf ("%d", &feet);
(void) getchar ();
printf ("Enter the value of inches: ");
scanf ("%d", &inches);
(void) getchar ();
printf ("Enter the value of yards: ");
scanf ("%d", &yards);
(void) getchar ();
total_inches=(yards*3+feet)*12+inches;
printf ("Value of total inches: %d\n", total_inches);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}