For Loops Worksheet
star
star
star
star
star
Last updated over 1 year ago
5 questions
1
for(int i=-3; i<19; i=i+3){ out.print(i + " ");}
for(int i=-3; i<19; i=i+3)
{
out.print(i + " ");
}
1
for(int j=17; j>-2; j=j-2){ out.print(j + " ");}
for(int j=17; j>-2; j=j-2)
{
out.print(j + " ");
}
1
for(int x=20; x<50; x=x+3){ out.print(x + " ");}
for(int x=20; x<50; x=x+3)
{
out.print(x + " ");
}
1
for(int m=37; m>0; m=m-4){ out.print(m + " ");}
for(int m=37; m>0; m=m-4)
{
out.print(m + " ");
}
1
int total=0;for(int s=1; s<19; s++){ total=total+s;}out.println(total);
int total=0;
for(int s=1; s<19; s++)
{
total=total+s;
}
out.println(total);