C program for converting distance from one unit to another.

Question: Write an interactive program called “DISTANCE CONVERTER” that accepts the distance in millimetres / feet / miles / yards / kilometres and displays its equivalent in metres.

Relationship between various units of distance is as follows:
– 1 meter = 1000 mm
– 1 meter = 3.28 feet
– 1 mile = 1609 meter
– 1 meter = 1.0936 yard
– 1 kilometer = 1000 meter

C program to convert distance from one unit to meter is as follows:

#include<stdio.h>
#include<conio.h>

void main()
{
	float distance_unit, distance_meter;
	int choice, cont = 1;
	clrscr();

	printf("\nDistance Converter\n");

	while(cont == 1)
	{
		clrscr();
		printf("\n1.Enter distance in Millimeters.\n");
		printf("\n2.Enter distance in Feet.\n");
		printf("\n3.Enter distance in Miles.\n");
		printf("\n4.Enter distance in Yards.\n");
		printf("\n5.Enter distance in Kilometers.\n");

		printf("\nEnter your choice: ");
		scanf("%d", &choice);

		printf("\nEnter distance: ");
		scanf("%f", &distance_unit);

		switch(choice)
		{
			case 1:
				//1 meter = 1000 mm
				distance_meter = distance_unit / 1000;
				break;
			case 2:
				//1 meter = 3.28 feet
				distance_meter = distance_unit / 3.28;
				break;
			case 3:
				//1 mile = 1609 meter
				distance_meter = distance_unit * 1609;
				break;
			case 4:
				//1 meter = 1.0936 yard
				distance_meter = distance_unit / 1.0936;
				break;
			case 5:
				//1 kilometer = 1000 meter
				distance_meter = distance_unit * 1000;
				break;
			default:
				printf("\nInvalid choice selected.\n");
				break;
		}

		printf("\nEquivalent distance in Metres is: %f\n", distance_meter);

		printf("\nDo you want to continue (1/0)? ");
		scanf("%d", &cont);
	}

	getch();
}