Decode School

Free Certification Courses from

C Program to convert Kilo Meters to Meters

Get Kilometer km from user and find meter m

Sample Input 1:


Sample Output 1:


Program or Solution

#include <stdio.h>

int main(void) 

	int m;

	float km;

	printf("enter kilometers:");	



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

	return 0;


Program 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)