1.

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

Answer»

#includeusing 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#includeint main void{Int adultint childrenInt weight_adultInt weight_childInt weight_limitprintf("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”)elseprintf (“The boat is not stable”)return



Discussion

No Comment Found