(b) The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.
Let Us C by Yashwant Kanetkar
Solution By Muhammad Kaleem UIlah
(b) The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.
Solution :
#include <stdio.h>
#include <stdlib.h>
int main()
{
float distance,m,f,i,cm;
printf("Enter The Distance in Km = ");
scanf("%f",&distance);
m=distance*1000;
printf("%f m\n",m);
f=m*3.28084;
printf("%f feets\n",f);
i=12*f;
printf("%f inches\n",i);
cm=2.54*i;
printf("%f cm\n",cm);
return 0;
}
Comments
Post a Comment