Thursday, January 17, 2013

C Language Example # 05 Distance Calculator Using C (Includes KM, Meter, Feet, Inch, Centimeter)

C Language Example # 05 Distance Calculator Using C (Includes KM, Meter, Feet, Inch, Centimeter).

Lets find the difference between to places using C Language !

C Language Code:

//Written by Latest Technology Guide    
//Title : Example 04 : Find Age of the Person by asking their birth year and current year.

#include <stdio.h>

#include <conio.h>
void main()
{
clrscr();
float km1,km2;

printf("Enter KM 1:");
scanf("%f",&km1);

printf("Enter KM 2:");
scanf("%f",&km2);

printf("\nDifference in KM is         :%.2f",km2-km1);
printf("\nDifference in Meter is      :%.2f",(km2-km1)*1000);
printf("\nDifference in Feet is       :%.2f",(((km2-km1)*1000)/3.0));
printf("\nDifference in Inch is       :%.2f",((((km2-km1)*1000)/3.0)/12));
printf("\nDifference in Centimeter is :%.2f",(((km2-km1)*1000)/12.0));

getch();
}



Output:

We think there is no need of Output for this program.


--------------------------------------------------------------------------------
Explanation of C Language Example # 05 : Distance Calculator Using C (Includes KM, Meter, Feet, Inch, Centimeter).

* Enter KM1 and KM2.
* Program will calculate the difference in Kilo Meter (KM), Meter, Feet, Inch and Centimeter.

Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements. 

No comments:

Post a Comment