Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Determine the number of times each for loop is executed for: a)for(i=1;i<=20;i=i

ID: 3624436 • Letter: D

Question

Determine the number of times each for loop is executed for:
a)for(i=1;i<=20;i=i+1)
b)for(icount=1; icount<=20; icount=icount+2)
c)for(j=1;j<=100; j=j+5)
d)for(icount=20; icount>=1; icount=icount-1)
e)for(icount=20; icount>=1; icount=icount-2)
f)for(count=1.0; icount<=16.2; icount=icount+0.2)
g) for(xcnt=20.0; xcnt>=10.0; xcnt=xcnt-0.5)

Determine the value in the total for each of the loops executd:
a)total=0;
for (i=1; i <=10; i=i+1)
  total=total +1;
b)total=1;
for (count=1; count <=10; count=count+1)
  total=total *2;
c)total=0;
for (i=10; i <=15; i=i+1)
  total=total +i;
d)total=50;
for (i=1; i <=10; i=i+1)
  total=total -i;
e)total=1;
for (icnt=1; icnt <=8; ++icnt)
  total=total *icnt;
f)total=1.0;
for (j=1; j <=5; ++j/)
  total=total/2.01;

Explanation / Answer

Determine the number of times each for loop is executed for:
a)for(i=1;i<=20;i=i+1)

20 times


b)for(icount=1; icount<=20; icount=icount+2)

10 times


c)for(j=1;j<=100; j=j+5)

100 / 5 = 20 times


d)for(icount=20; icount>=1; icount=icount-1)

20 times


e)for(icount=20; icount>=1; icount=icount-2)

10 times


f)for(count=1.0; icount<=16.2; icount=icount+0.2)

16.2 / 0.2 = 81 times


g) for(xcnt=20.0; xcnt>=10.0; xcnt=xcnt-0.5)

20 times.

only one question per psot dude :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote