C++ Function that converts inches to centimetre.

//C++ Function that converts inches to centimetre.

#include <iostream>
using namespace std;
float convert(float a);

int main() 
{
	float inch,cm;
	cout << "Enter value in Inch : ";
	cin >> inch;
	cm=convert(inch);
	cout << inch <<" inch is equal to "<< cm <<" centimeter ";
        return 0;
}
float convert(float a)
{
	float cm1;
	cm1=a*2.54;
	return cm1;
}

Output :
Enter value in Inch : 50

50.00 inch is equal to 127.00 centimeter



Leave a comment