Thursday 30 August 2012

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.


main()
{
 float D_km,D_m,D_f,D_i,D_cm;
 printf("\nEnter distance in Kilometers\n");
 scanf("%f",&D_km);
 D_m=D_km*1000;
 D_f=D_km*3280.84;
 D_i=D_km*39370;
 D_cm=D_km*100000;
 printf("After conversion of %f km result is :-\n ",D_km);
 printf("\nmeter = %f m\n",D_m);
 printf("feet = %f foot\ninches = %f inches\n",D_f,D_i);
 printf("centimeter = %f cm",D_cm);
}

output:-

1 comment:

  1. amit plz tel me the the simple program to convert distanse between two cities in kilometers and convert it into meters, inches and centimeters

    ReplyDelete