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.
9 2695
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.
How much you tried show me that code and let me know where you stuck.
Kind regards,
Dmjpro.
i'm not even sure where to start
i'm not even sure where to start
First let me know how long you are working with Java?
Have a close look on it. -
for(int i=1;i<=100,0000;i++)
-
if(i%7==0||i%11==0||i%13==0) System.out.println(i);
-
Good Luck!
And never come with these type of easy problems.
Kind regards,
Dmjpro.
First week of java for me. Thanks for the help.
First let me know how long you are working with Java?
Have a close look on it. -
for(int i=1;i<=100,0000;i++)
-
if(i%7==0||i%11==0||i%13==0) System.out.println(i);
-
Good Luck!
And never come with these type of easy problems.
Kind regards,
Dmjpro.
That won't compile
I have not tested it yet. Why do you say it will not compile?
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.
Well, the smallest number that is divisable by 7, 11, and 13 is 7x11x13 == 1001
because all of 7, 11, and 13 are prime numbers.
kind regards,
Jos
In 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.
In 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.
No, a number can only be divided by 1001 if it can be divided by 7, 11, and 13,
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,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Colin Mardell |
last post by:
I need to get VBA to produce a msgbox when the number of records in
the background query is exactly divisible by 5.
|
by: Frederick Gotham |
last post by:
I'm trying to devise a compile-time constant for X, where X is the
greatest number which satisfies both the following criteria:
(1) X <= DESIGNATED_MAX_VALUE
(2) X % Y == 0
I'll try to...
|
by: geskerrett |
last post by:
I am sure this is a basic math issue, but is there a better way to
ensure an int variable is divisible by 4 than by doing the following;
x = 111
x = (x /4) * 4
Just seems a bit clunky to me.
|
by: Qdiddy34 |
last post by:
Hey Guys, I'm trying figure out how to write a JavaScript for a textbox that contains an integer not divisible by 7.
My aspx form has two textboxes (for integers) and a button (multiply). I have...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |