Thursday, May 7, 2015

C program to convert distance into meters and feet

 The distance between two cities(in km) is input through the keyboard. Write a program to  convbert and print this  distance in meters,feet,inches and centimeters.

#include<stdio.h>
#include<conio.h>
main()
{
                 float km,m,cm,ft,inch;
                 printf("\nEnter the distance in kilometers:");
                 scanf("%f",&km);
                 m=km*1000;
                 cm=m*100;
                 inch=cm/2.54;
                 ft=inch/12;
                 printf("\nDistance in meters=%f",m);
                 printf("\nDistance in centimeter=%f",cm);
                 printf("\nDistance in feet=%f",ft);
                 printf("\nDistance in inches=%f",inch);
                 printf("\n\n\n\nPress any key to exit..");
                 getch();
                
                
                
                 }


No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...