SCHOOL03-Editorial

PROBLEM LINK:

Practice : https://www.codechef.com/problems/SCHOOL03

Contest :https://www.codechef.com/COSK19TS

Author: laks

Editorialist: laks

DIFFICULTY:

CAKEWALK.

PREREQUISITES:

NO.

PROBLEM:

Ram wants to step upstairs one by one and he wants to step on odd stair only and reach to the top of his house. While Ram is busy to handle grocery in his hands, can you please help Ram for counting the number of steps he took to reach the top?

input: Input an integer number on one line than other on next line.

Output: For each test case, output in a single line answer given by the total number of odd steps he took.

QUICK EXPLANATION:

In this, a problem you have to create a program in which you should enter the number and till user wants and then you have to print total odd steps taken by user.

EXPLANATION:

In this, you have to write code like this first, you have to write while loop for the number of input cases then, you have to enter numbers until test cases come to end then, you should count the odd steps by writing condition in if statement that input is divisible by 2 if yes not increment variable if not divisible increment finally, print the variable as output.

SOLUTIONS:

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

int main() {
int a,t=3,x=0;
while(t–){
cin>>a;
if(a%2!=0){
++x;
}
}
cout<<x<<endl;
return 0;
}