i need help on how to write a code that will print numbers 1-100,0000 and the #s are divisible by 7,11, and 13. I was told to start with 1001/7, 1001/11, 1001/13. I just don't get this and need it urgently.
divisible by
Collapse
X
-
How much you tried show me that code and let me know where you stuck.Originally posted by kris mynni need help on how to write a code that will print numbers 1-100,0000 and the #s are divisible by 7,11, and 13. I was told to start with 1001/7, 1001/11, 1001/13. I just don't get this and need it urgently.
Kind regards,
Dmjpro. -
First let me know how long you are working with Java?Originally posted by kris mynni'm not even sure where to start
Have a close look on it.
[code=java]
for(int i=1;i<=100,0000 ;i++)
if(i%7==0||i%11 ==0||i%13==0) System.out.prin tln(i);
[/code]
Good Luck!
And never come with these type of easy problems.
Kind regards,
Dmjpro.Comment
-
That won't compileOriginally posted by dmjproFirst let me know how long you are working with Java?
Have a close look on it.
[code=java]
for(int i=1;i<=100,0000 ;i++)
if(i%7==0||i%11 ==0||i%13==0) System.out.prin tln(i);
[/code]
Good Luck!
And never come with these type of easy problems.
Kind regards,
Dmjpro.Comment
-
Well, the smallest number that is divisable by 7, 11, and 13 is 7x11x13 == 1001Originally posted by kris mynni need help on how to write a code that will print numbers 1-100,0000 and the #s are divisible by 7,11, and 13. I was told to start with 1001/7, 1001/11, 1001/13. I just don't get this and need it urgently.
because all of 7, 11, and 13 are prime numbers.
kind regards,
JosComment
-
No, a number can only be divided by 1001 if it can be divided by 7, 11, and 13,Originally posted by kris mynnIn the output data i was told i should see 1111 and 123123... So would it be 1001/7, 1001/11, 1001/13? I don't know how that would be coded.
so you should only check if x/1001 doesn't have a remainder. Don't bother about
7, 11 and 13 individually, i.e. simply check if the remainder of x and 1001 is 0.
kind regards,
JosComment
Comment