Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

C%20%20%20Interview%20Questions%20and%20Answers

Question: Detemine the code below, tell me exectly how many times is the operation sum++ performed ?
Answer:
for ( i = 0; i < 100; i++ )
for ( j = 100; j > 100 - i; j?)
sum++;

(99 * 100)/2 = 4950
The sum++ is performed 4950 times.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook