Problem Statement:
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.
keyboard. Write a program to convert and print this distance
in meters, feet, inches and centimeters.
Solution:
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int km,m,cm;
float inch,foot;
cout<<"Enter Distance between two cities in Kilo Meters:\n";
cin>>km;
m=km*1000;
cm=m*100;
foot=3.28084*m;
inch=12*foot;
cout<<"The Distance is:\n"
<<m<<" meters\n"
<<cm<<" centi meters\n"
<<foot<<" Feet\n"
<<inch<<" inches\n";
getch();
}
No comments:
Post a Comment