My assignment is as follows=
write a program that:
-prompts the User for a 2 digit positive integer that does not end in zero
-displays the sum of the numbers divisible by the second digit that are less than the imputed number
Example:
User enters 25, outputs 50 (5+10+15+20)
enter 26, outputs 60 (6+12+18+24)
enter 11, output 55 (1+2+3+4+5+6+7+8+9+10)
Basically, I forgot how to seperate the two digit integer. I know there's something you can do with the string class, or dividing by a multiple of 10, I just cant for the life of me remember what :/
other than that, it should just be a loop. I'm blanking so bad though.
Would something like this work? I'm using the 25 example
//num is the imputed integer
for(I=1; I<=divisors; I++)
// divisors is the quotient of num and the second number, an integer.
{
multiple=secondNum*I;
System.out.println(multiple);
sum=sum+multiple;
}
I know I skipped a lot, but basically secondNum would have the second number. Multiple would be the second number times I, which is incrementing from 1 to the amount of times secondNum goes into the imputed number. Sum is the easy part.
basically, all I need to know is how to get the god damn secondNum
write a program that:
-prompts the User for a 2 digit positive integer that does not end in zero
-displays the sum of the numbers divisible by the second digit that are less than the imputed number
Example:
User enters 25, outputs 50 (5+10+15+20)
enter 26, outputs 60 (6+12+18+24)
enter 11, output 55 (1+2+3+4+5+6+7+8+9+10)
Basically, I forgot how to seperate the two digit integer. I know there's something you can do with the string class, or dividing by a multiple of 10, I just cant for the life of me remember what :/
other than that, it should just be a loop. I'm blanking so bad though.
Would something like this work? I'm using the 25 example
//num is the imputed integer
for(I=1; I<=divisors; I++)
// divisors is the quotient of num and the second number, an integer.
{
multiple=secondNum*I;
System.out.println(multiple);
sum=sum+multiple;
}
I know I skipped a lot, but basically secondNum would have the second number. Multiple would be the second number times I, which is incrementing from 1 to the amount of times secondNum goes into the imputed number. Sum is the easy part.
basically, all I need to know is how to get the god damn secondNum