Program: 52
Write a program to convert the distance from km to m,cm,feet and inches. | Let Us C Solutions
#include<stdio.h> int main() { float km, m, cm, f, in; printf("Enter distance in kilometers: "); scanf("%f",&km); /* Calculate the conversion */ m = 1000 * km; cm = 1000 * 100 * km;
f = 3280.84 * km;
in = 39370.08 * km; printf("The distance in Feet: %f\n", f); printf("The distance in Inches: %f\n", in); printf("The distance in Meters: %f\n", m); printf("The distance in Centimeters: %f\n", cm);
return (0); }
Output:
Enter distance in kilometers: 2 The distance in Feet: 6561.680176 The distance in Inches: 78740.156250
The distance in Meters: 2000.000000
The distance in Centimeters: 200000.000000
Leave a Comment