• Language

    C

  • Description

    It converts centimeters to inches, inches to feet, feet to meters, meters to kilometers, and kilometers to miles.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    float centimeters, feet, inches, kilometers, meters;
    float miles;
    printf ("Enter the value of centimeters: ");
    scanf ("%f", &centimeters);
    (void) getchar ();
    inches=centimeters/2.54;
    feet=inches/12;
    meters=feet*100/12/2.54;
    kilometers=meters/1000;
    miles=kilometers/1.609344;
    printf ("Value of feet: %g\n", feet);
    printf ("Value of inches: %g\n", inches);
    printf ("Value of kilometers: %g\n", kilometers);
    printf ("Value of meters: %g\n", meters);
    printf ("Value of miles: %g\n", miles);
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}