Pages

Tuesday, July 30, 2013

[H]. (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.

void main()
{
double km, m, ft, inch, cm;
clrscr();
printf("Enter Distance Between Two City in Kilometer : ");
scanf("%lf",&km);
m=km*1000;
ft=km*3280.8399;
inch=km*39370.0787;
cm=km*100000;
printf("\n%lf Kilometer = %lf Meter",km,m);
printf("\n%lf Kilometer = %lf Feet",km,ft);
printf("\n%lf Kilometer = %lf Inch",km,inch);
printf("\n%lf Kilometer = %lf Centimeter",km,cm);
getch();
}

No comments:

Post a Comment