C Program to convert Kilo Meters to Meters

Description

Get Kilometer km from user and find meter m
Sample Input 1:
56
Sample Output 1:
56000

Solution

#include <stdio.h>



int main(void) 

{
	
	
	int m;


	float km;

	printf("enter kilometers:");	

	scanf("%f",&km);
	

	m=km*1000;
	

	printf("Meters: %d",m);

	
	return 0;


}

Explanation

Get kilometer km as input (using scanf statement)  (since kilometer may be in fractional values like 1.2 and 5.2, it is declared & read as float.) 

Calculate meter m by multipllying kilometer km with 1000. (m=km*1000, 1000 meter is equal to 1 kilometer)

print meter m. (using printf statement)