SCHOOL02-Editorial

PROBLEM LINK:

Practice : SCHOOL02 Problem - CodeChef

Contest :Contest Page | CodeChef

Author: laks

Editorialist: laks

DIFFICULTY:

CAKEWALK.

PREREQUISITES:

NO.

PROBLEM:

Use approach wisely. Chef wants to calculate the number of people come in the restaurant and when the total number of people exceeds 50 then chef closes the bakery because the total number of cakes in the bakery is 50. The chef is busy somewhere else so she wants help. Can you help the chef to calculate?

Input: Input integer in a single line and when new people come to enter the total number.

output: when 50 come in bakery print “Close”.

QUICK EXPLANATION:

In this, a problem you have to create a program in which you should enter the number and till it becomes 50 after that close will appear on the output screen.

EXPLANATION:

In this, you have to write code like this first, you have to write while loop for the number of input you have to enter and then, you have to write condition in while loop that input is not equal to 50 if condition true run the loop and print statement (output) otherwise exit if it is 50 and outside loop you should use print statement to print close.

SOLUTIONS:

[details=“Setter’s Solution”]
# include
using namespace std;

int main() {
// your code goes here
int a,t=5,x;
while(t–){
cin>>a;
x=x+a;
if(x==50)
{cout<<“Close”;
return 0;}
}
return 0;
}