Write a C++ program that convert a person's height from inches to centimetres using the formula 2.54* height.

 #include<iostream>

using namespace std;

int main()

{

float height_in_cent;

float height;

cout<<"Enter height in inches: ";

cin>>height;

height_in_cent = height*2.54;

cout<<"Your height in centimeters is: ";

cout<<height_in_cent;

}

OUTPUT

Enter height in inches: 20

Your height in centimeters is: 50.8

--------------------------------

No comments:

Post a Comment