You went on a tour to Ooty with your friends. As a part of the tour, you went boating with them. For the boat to remain stable, the number of people on one boat is restricted based on the weight of the people. You find that the boatman who is sailing your boat is so much greedy of money. For earning more, he takes too many people to travel in the boat at a time. So you want to check how many people can travel in the boat at a time so that the boat will not drown. Calculate the weight by considering the number of adults and number of children. Assume that an adult weighs 75 kg and children weigh 30 kg each. If the weight is normal, display Boat is stable, else display Boat will drown.
INPUT & OUTPUT FORMAT:
Input consists of 3 integers.
First input corresponds to the weight that the boat can handle.
Second input corresponds to the number of adults.
Third input corresponds to the number of children.
SAMPLE INPUT:
340
2
3
SAMPLE OUTPUT:
Boat is stable
Case 1
Case 2
Case 3
Input (stdin)
340
2
3
Output (stdout)
Boat is stable
Answers
Answer:
#include<iostream>
using namespace std;
int main()
{
int a,b,c,adult,children,h;
cin>>a>>b>>c;
adult=b*75;
children=c*30;
h=adult+children;
if(h<=a){cout<<"Boat is stable";}
else{cout<<"Boat will drow";}
explanation:
Code written in C language
#include<stdio.h>
int main void
{
Int adult
int children
Int weight_adult
Int weight_child
Int weight_limit
printf("Enter the number of adults in boat");
scanf("%d", &adult);
printf("Enter the number of children in boat");
scanf("%d", &children);
weight_adult = adult *75;
weight_child = children *30;
if (weight_limit > (weight_adult + weight_child))
printf (“The boat is stable”)
else
printf (“The boat is not stable”)
return
Answer:
5.My partner and I build our boat and test to see how many pennies our boat will hold. What part of the problem-solving process are we working on? *