The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+2 votes
224 views
for(int i=0; i<=100;i++) {
if (i % 3 == 0)
printf("Great);
if(i%5 == 0)
printf("India");
}

Count the number of times GreatIndia is printed.

  1. 6
  2. 20
  3. 33
  4. none of these
asked in Programming by (75 points)
edited by | 224 views
0

@

the answer should be $21$, please solve again.

0
Okay it means I have to take every possible combination of multiple of 3 and 5 here
0
For I = 0 nothing will be will be printed
0
$i=0$

"GreatIndia" will be printed.
0
For i=0 great india will be printed.
0
how 0 mod 3 wouldn't be equal to zero
0
0 mod 3 means remainder when we divide 0 by 3 so it is 0
0
Okay got confused it's zero is divided by three not the other way
0
if this question comes in gate then we will execute the loop step by step for 100 times ?
0

@ no, we can observe how condition satisfied and generalize the condition.

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,808 questions
54,481 answers
188,249 comments
74,526 users