Write a program that takes length as input in feet and inches and convert it into centimeters. Using the constant for declaration of conversion constants. To calculate the equivalent length in centimeters, you need to multiply the total inches by 2.54. Similarly, to find the total inches, you need to multiply the feet by 12 and add the inches.
#include <iostream>
using namespace std;
int main()
{
int inches, feet;
cout << "Please, enter inches and feets to take the length:";
cout << "\nInches:";
cin >> inches;
cout << "Feets:";
cin>> feet;
float centimetr=(feet*12+inches)*2.54;
cout << "\nThe equivalent length in centimeters is "<< centimetr;
}
Comments
Leave a comment