C Program to Convert km to miles

In this example we are going to convert km to miles using C program. In program first we take input from user in KM then we will convert it into Miles using Bellow formula.

1 km = 0.621 miles

Convert km to miles using C program

#include<stdio.h>
void main()
{
  float km, miles;
  printf("Enter any values in km : ");
  scanf("%d",&km);
  miles = km * 0.621;
  printf("%.2f kilometer is = %.2f miles",km,miles);
}

Output

Enter any values in km : 15
15.00 km is = 9.32 miles

Explanation

In this program we have taken a input from user in KM then we converted it into mile using the formula hence we display the result.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *