Write a C program to calculate the distance between two cities

c program afor distance conversion
c program afor distance conversion

Problem Statement:

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


/* Conversion of distance */

#include <stdio.h>
#include <conio.h>


float km, m, cm, ft, inch;

clrscr(); /* To clear the screen */
print(“\n Enter the distance in Milometers:”);
scanf(“%f”, &km);


printf(“\nDistance in mters=%f”,m);
printf(“\nDistance in centimter=%f”,cm);
printf(“\nDistance in feet=%f”,ft);
printf(“\nDistance in inches=%f”,inch);

printf(“\n\n\n\n\n Press an key to exit….”);
getch(); /* To read a character from keyboard */

Please run this program and share the output with us.


For any query or issue, feel free to discuss on http://discuss.eduguru.in

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply