1,771 views
4 votes
4 votes

Consider the following program fragment:

int d = 0;
int i,j,k;
for(i=1; i<31; ++i)
        for(j=1; j<31; ++j)
	        for(k=1; k<31; ++k)
		        if(((i+j+k)%3) == 0)
		                d=d+1;
printf("%d",d);

The number of additions performed by the above program fragment is?

a. 27,000

b. 27,000 x 3

c. 27,000 x 3 + 9,000

d. 9,930 + 2,700 x 3

1 Answer

Related questions

3 votes
3 votes
2 answers
3
0 votes
0 votes
1 answer
4
TusharKumar asked Dec 22, 2022
524 views
can anyone explain how the for loop works here..?