Code
Hint: 1 km = 1000 meters, 1 meter = 3.28 feet, 1 foot = 12 inches, foot = 30 centimeters#include<stdio.h>
int main()
{
int a,b,c,d,f;
printf ("Enter the distance (in km): ");
scanf ("%d",&a);
b = a * 1000;
c = b * 3.28;
d = c * 12;
f = d * 30;
printf ("\nDistance in meters = %d m",b);
printf ("\nDistance in feets = %d feet",c);
printf ("\nDistance in inches = %d inches",d);
printf ("\nDistance in centimeters= %d cm",f);
printf ("\n\npress any key to close.");
getch ();
return 0;
}
There is problem in conversion from km to cm. It should be f=d*2.54. check the answer in cm it's more than 2500000.
ReplyDeleteThank You For Reporting It. We Will Fix It ASAP.
DeleteRead next: C Program to convert distance in meters, feet, inches, and centimeters
ReplyDelete