asked 140k views
2 votes
Write a C++ program to convert rainfall in inches to rainfallin millimeters given that:

1 inch = 25.4 mm
Sample output: 4 inches = 101.6 mm of rain

asked
User Palto
by
8.4k points

1 Answer

5 votes

Answer:

#include <iostream>

using namespace std;

int main() {

float rainfall_inch,rainfall_mm;//declaring two variables of float type to hold the value rain in inches and mm.

cin>>rainfall_inch;//taking input of rain in inches..

rainfall_mm=rainfall_inch*25.4;//conveting inches to mm and storing in raingfall_mm.

cout<<rainfall_inch<<" inches = "<<rainfall_mm<<" mm of rain"<<endl;//printing the output.

return 0;

}

Step-by-step explanation:

The above written program is in c++ for converting the rainfall in inches to mm.

I have taken two variables of type float to store the values of rainfall in inches and mm.

Conversion of inches to mm.

Printing the result.

answered
User Hanzo
by
8.2k points

No related questions found