edited by
622 views
1 votes
1 votes

What cannot replace ‘?’ in the following C-code to print all odd numbers less than $100$ ?

for (i=1; ? ; i=i+2)
    printf("%d\n", i);
  1. $i\leq100$
  2. $i\leq101$
  3. $i<100$
  4. $i<101$
edited by

1 Answer

0 votes
0 votes
$101$ being the first odd number greater than 100, and from where we do not print further odd numbers.

But option B ensures that $101$ gets printed which we don't want.

So, option B is correct.

Related questions

1 votes
1 votes
1 answer
1
go_editor asked Mar 28, 2020
649 views
Which of the following is a valid C code to print character ‘A’ to ‘C’ ?x='A' ; switch(x) {case 'A'= printf ( "%d\n" , x); .... case 'C'= printf ( "%d\n" , x); }x...
2 votes
2 votes
1 answer
2
1 votes
1 votes
2 answers
3
go_editor asked Mar 28, 2020
1,249 views
The number of edges in a complete graph with $‘n’$ vertices is equal to :$n(n-1)$$\large\frac{n(n-1)}{2}$$n^2$$2n-1$
0 votes
0 votes
1 answer
4
go_editor asked Mar 28, 2020
550 views
A context free grammar is :type $0$type $1$type $2$type $3$