Skip to main content

Program for KiloMeters to mile In C

Here is C Program – Complete code to convert kilometers to mile by accepting user input.

Formula used in program is : miles=(km/1.609344);

//Accept Distance in Kilometer 
// from km to miles need to divide appx  1.609344


void main()
   float km,miles;// declaring variable as float as km can be in decimal.

   printf("\n\t Enter Kilometer to Convert it in miles: ");
   scanf("%f",&km);    //%f Read float value

   //Now converting kilometer to Miles


   printf("\n\t %f kilometer in Miles are %f ",km,miles);


    Enter Kilometer to Convert it in miles: 1

         1.000000 kilometer in Miles are 0.621371