The distance between two cities (in km) is input through the keyboard. Write a program in C to convert and print this distance in meters, feet, inches and centimeters

The distance between two cities (in km) is input through the keyboard. Write a program in C to convert and print this distance in meters, feet, inches and centimeters. 

            #include <stdio.h>
            #include <conio.h>
            void main() {
                        float km, meter, feet, inch, cm;
                        clrscr();
                        printf("Enter the distance between cities in KM : ");
                        scanf("%f", &km);
                        meter=km*1000;
                        feet=meter/0.3048;
                        inch=feet*12;
                        cm=meter*100;
                        printf("\n\n");
                        printf("Meters = %f \nFeet = %f \nInches = %f \nCentimeters = %f", meter, feet, inch, cm);
                        getch();
            }


Post a Comment