## guatemalagirl

the purpose of my program is to ask the user for their numerical grades (depending on how many total grades they have) and then they are given their letter grade. but i cant get the for loop to loop the question according to their number of total grades

import TerminalIO.*;
public static void main(String [] args){

}
}
}

## sillyboy 43

so you initialise grades to 1. (why? considering you ask the user for grades... you are overwriting what you want to know)

you want to loop if grades is greater or equal to 1.

each loop you want to increment grades by 1.

## guatemalagirl

what should i initialize it as?

## BrianK123

Make another counter int.
For example:

int grades;
int counter;

for ( counter = 1; counter >= grades; counter++) {
etc.

that should do it I believe

## sillyboy 43

that won't work, but the idea is there. you don't even need to introduce a separate counter, but you should really try work this out yourself.

note: you don't need to initialise inside a for loop if you don't want.

didnt work :(

## sillyboy 43

which is why i said it won't work...

think logically through your code and it should be pretty simple what is wrong.

## danielernesto -1

You should try an normal loop, a nice loop with my friend the varible "i", then continue , until my varible "i" is less than grades, in the mean time the loop will be "looping".

number = 10;
sum = 0;
for (var i=1; i<= number; i++) {
sum = sum + number;
}
document.write("sum = " + sum);

number = 10;
for (var i=number; i > 0; i--) {
if ( i%2 == 1)
document.write(i);
}

product = 1;
number = 5;
for (var i=1; i < (number+1); i++) {
product = product * number;
}
document.write(product);

for ( var i=1; i<= 5; i++) {
for (var j=1; j<=3; j++) {
document.write("*");
}
document.write("<br />");
}

number = 10;
sum = 0;
for (var i=1; i<= number; i++) {
sum = sum + number;
}
document.write("sum = " + sum);

number = 10;
for (var i=number; i > 0; i--) {
if ( i%2 == 1)
document.write(i);
}

product = 1;
number = 5;
for (var i=1; i < (number+1); i++) {
product = product * number;
}
document.write(product);

for ( var i=1; i<= 5; i++) {
for (var j=1; j<=3; j++) {
document.write("*");
}
document.write("<br />");
}

## verruckt24 438

I suppose you need to ask for the number of grades and then continue looping in the for loop for those many times.
Now, if you understand the for loop construct,
initialise a counter to 1 and continue it to the number of grades, incrementing it once every time.
Think on this and let us know the result.