edited by
1,040 views

1 Answer

Best answer
5 5 votes

so initially we checked condition (200>=80) and it passed  then from next time onwards we are decreasing i by 2 and increasing n by 1 and then comparing

so assume after first comparison we run this loop k times and then we get i =n

so,

200-2-2-2…..k times = 80+1+1+1…...k times

200-2k= 80+k

3k=120

k=40

 

so,

initially we checked for i=200 and n=80 and it passed

then we keep on checking till i=120 and n=120 (which means we checked for k=40 more times)

after 40th time i became 118 and n became 121

then we checked 1 more time and this time loop failed because 118>=121 is not true.
 

so total this condition i>=n is checked for 42 times.

selected by
Position:
Show:

Related questions

2 2 votes
1 1 answer
808
808 views
shivamSK asked Jun 15, 2024
808 views
#include <stdio.h int main () { int i, k; int a [8] = {33,34,35,36,37,40,50,38}; for(i = 0; i < 3; i++) { a[i] = a[i] + 1; i=i+1; } i=i-1; for (k = 7; k 4; k ) { int i =...
0 0 votes
1 1 answer
1.4k
1.4k views
aashish1406 asked Aug 9, 2023
1,430 views
Suppose we have a directed graph G = (V,E) with V= {1, 2, ..., n} and Eis presented as an adjacency list. For each vertex u in V, out(u) is a list such that (u, v) in {1,...
0 0 votes
2 answers 2 answers
1.1k
1.1k views
rohitkaushal1 asked Sep 22, 2022
1,077 views
What will be the output printed for find(4)? void find(int x) { static int i = 10, y = 0; y = y + i; for(i; i>0; i = i - 10) { if(x! = 0) find(x – 1); else printf(“%d”, y...
1 1 vote
1 1 answer
778
778 views
Piyush mishra asked Nov 25, 2018
778 views
Assume an array A[1,……..,n] has n elements, and every element of an array is less than or equal to n.An element is said to be “majority element”,if it is occured in more...