Trying to learn C language, completed upto basic Data types from W3 Schools. So, the question is to input the distance between two cities in km and the output should be in meters, feet, inch, cm. I tried running this code in Vs code. It was showing only "running" in the output box.
#include <stdio.h>
int main(){
float dist_km,m,cm,feet,inch;
printf("Enter distance bet two cities in km= ");
scanf("%f", dist_km);
m=dist_km*1000;
cm=m*100;
inch=cm/2.54;
feet=inch/12;
printf("\n dist in m= %f",m);
printf("\n dist in cm= %f",cm);
printf("\n dist in inch= %f",inch);
printf("\n dist in feet= %f",feet);
return 0;
}
This is the code. The expected should be in meters, cm,etc but I am getting this:
Enter distance bet two cities in km= 29.5
dist in m= 0.000000
dist in cm= 0.000000
dist in inch= 0.000000
dist in feet= 0.000000
Please help me to solve this problem . Thanks