Computer Science, asked by aryanpandey505, 9 months ago

(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.​

Answers

Answered by jaganap55
8

Answer:

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;

}

Similar questions