473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

divisible by

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.
Oct 2 '07 #1
9 2695
dmjpro
2,476 2GB
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.
Oct 2 '07 #2
i'm not even sure where to start
Oct 2 '07 #3
dmjpro
2,476 2GB
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.

Expand|Select|Wrap|Line Numbers
  1. for(int i=1;i<=100,0000;i++)
  2.  if(i%7==0||i%11==0||i%13==0) System.out.println(i);
  3.  
Good Luck!
And never come with these type of easy problems.

Kind regards,
Dmjpro.
Oct 2 '07 #4
First week of java for me. Thanks for the help.
Oct 2 '07 #5
r035198x
13,262 8TB
First let me know how long you are working with Java?
Have a close look on it.

Expand|Select|Wrap|Line Numbers
  1. for(int i=1;i<=100,0000;i++)
  2.  if(i%7==0||i%11==0||i%13==0) System.out.println(i);
  3.  
Good Luck!
And never come with these type of easy problems.

Kind regards,
Dmjpro.
That won't compile
Oct 2 '07 #6
I have not tested it yet. Why do you say it will not compile?
Oct 2 '07 #7
JosAH
11,448 Expert 8TB
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
Oct 2 '07 #8
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.
Oct 2 '07 #9
JosAH
11,448 Expert 8TB
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
Oct 2 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
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.
21
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...
15
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.
7
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.