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.
void main()
{
float distance,distancem,distancefeet,distanceinches,distancecm;
printf("\nInput distance in km");
scanf("%f",&distance);
distancem= distance*1000.0;
distancefeet= distancem*3.2808;
distanceinches= (distance*100000.0)/2.54;
distancecm = distance*100000.0;
printf("\n Distance in metres = %fm\n Distance in feet = %fft\n Distance in inches = %finches\n Distance in cm = %fcm",distancem,distancefeet,distanceinches,distancecm);
}
Subscribe to:
Post Comments (Atom)
ReplyDeleteC Program to convert distance in meters, feet, inches, and centimeters