Chapter - 1: Getting Started

The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.


C
Sections
2
Exercises
#include<stdio.h>
#include<conio.h>
int main()
{
	float dis;
	
	printf("Enter the distance between cities in kilo metres : ");
	scanf("%f", &dis);
	
	printf("\n%f is the distance between them in meters.", dis*1000);
	printf("\n%f is the distance between them in feet.", dis*3280.8399);
	printf("\n%f is the distance between them in inches.", dis*39370.0788);
	printf("\n%f is the distnace between them in centimeters", dis*100000);
    
	getch();
	return 0;
}

© 2021 Garbage Valuegarbage value logo