Question #178248

A carpenter wants to make a ladder, but he want to calculate the required wood for it. The distance

between each step is 1 foot. Write a C++ program in which, take the length and width of ladder as input

from user and calculate the required wood. Price of wood is 500 per foot, now calculate the price of

wood as well.

Example:

Input: Output:

Enter the length of ladder in foot: 25

Enter the width of ladder in foot: 2

Required wood in foot: 98

Cost of wood is: 49000


Expert's answer

#include <iostream>
using namespace std;

int main() {
int length,Width,result,money;
   cout << "Enter the Length of ladder in foot: " ;
   cin >> length;
   cout << "Enter the Width of ladder in foot: " ;
   cin >> Width;
  
   result=length*Width*1.96;
   money=result*500;
  
   cout<<"Required wood in foot: "<<result<<endl;
   cout<<"Cost of wood is :"<<money;
  
   return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS