•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 402,048 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,522 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 797 | Replies: 30
![]() |
For 2, what are all even numbers divisible by that odd numbers are not?
For 4, loop backwards.
For 5, nested loops.
For 6, a loop and a an array of length 5 for summing, and divide by 10 and minus 5 to index into it.
There, there are the ideas for each of them.
Us doing your homework for you would not help you. You would learn nothing, and so would come back here tommorrow begging for "help" again, because what you need to do tommorrow built on what you did today, but you didn't do anything today (other than cut-n-paste). That's the way it is, if we simply do it for you, so, no, we are not going to do it for you, that does not help you. Those who fail with effort still understand more than those who pass without it.
For 4, loop backwards.
For 5, nested loops.
For 6, a loop and a an array of length 5 for summing, and divide by 10 and minus 5 to index into it.
There, there are the ideas for each of them.
Us doing your homework for you would not help you. You would learn nothing, and so would come back here tommorrow begging for "help" again, because what you need to do tommorrow built on what you did today, but you didn't do anything today (other than cut-n-paste). That's the way it is, if we simply do it for you, so, no, we are not going to do it for you, that does not help you. Those who fail with effort still understand more than those who pass without it.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
Join Date: Jul 2008
Posts: 11
Reputation:
Rep Power: 0
Solved Threads: 0
hey again >>>
i have solve the second one>>
2. Write a program to compute the sum and product of all odd integers from 1 to 19.
<<<<<<<<<
the answer is :
i dont know if its correct <<<
and the athers i dont understand the real idea >>
but i'll try ....
i have solve the second one>>
2. Write a program to compute the sum and product of all odd integers from 1 to 19.
<<<<<<<<<
the answer is :
import java.util.Scanner;
public class program1 {
public static void main(String [] args){
Scanner scan =new Scanner(System.in);
int sum =0, product=1 ;
for (int x = 1; x <= 19; x++) {
if (x % 2 ==1)
sum=sum+x;
}
for (int y = 1; y <= 19; y++) {
if (y % 2 ==1)
product=product*y;
}
System.out.println( sum+" "+ product );
}
}i dont know if its correct <<<
and the athers i dont understand the real idea >>
but i'll try ....
Last edited by Tekmaven : Jul 22nd, 2008 at 3:35 am. Reason: Code tags
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,222
Reputation:
Rep Power: 10
Solved Threads: 270
Does it compile?
Are there any errors?
Is it doing what you expect to do?
And please start using code tags (without spaces inside square brackets)
Are there any errors?
Is it doing what you expect to do?
And please start using code tags (without spaces inside square brackets)
•
•
•
•
[ code=java]
private final String = "For easy readability, always wrap programming code within posts in [ code] (code blocks) and [icode] (inline code) tags.";
[/code]
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
It could help if you try to go over your program and write a pseudocode and then browse over java tutorials to interpret your pseudocode into java codes....
With a little effort you can answer these problems...
try the following links:
http://www.java2s.com/
http://www.roseindia.net/programming...Java-Tutorials
http://www.skillbuilders.com/Tutoria...0Tutorials.cfm
With a little effort you can answer these problems...
try the following links:
http://www.java2s.com/
http://www.roseindia.net/programming...Java-Tutorials
http://www.skillbuilders.com/Tutoria...0Tutorials.cfm
Last edited by loken : Jul 21st, 2008 at 9:24 pm. Reason: java references
Crash dump, something worse than dying...
With the exception of that second link which has mainly obsolete, and often times simply bad, tutorials/examples/advice. Roseindia is a blight on the Java world. Nearly everytime I see someone use some really bad practice on many forums and tell them not to do that, they often come back and say "But the tutorial I followed showed it this way!". And where did they get that tutorial ---> Roseindia. Nuff said.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
•
•
With the exception of that second link which has mainly obsolete, and often times simply bad, tutorials/examples/advice. Roseindia is a blight on the Java world. Nearly everytime I see someone use some really bad practice on many forums and tell them not to do that, they often come back and say "But the tutorial I followed showed it this way!". And where did they get that tutorial ---> Roseindia. Nuff said.
Lol...
The site didn't seem organized to me just at first glance. I'll probably never go there again.
I've probably learned more here than I have alone. Dani for the win (yes I spelled it out) =P
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,222
Reputation:
Rep Power: 10
Solved Threads: 270
Also first link to java2s.com is loose-win situation.
I would not recommend that site to beginner because either they will learn nothing from it as it does not contain any explanation to the code (code there is simple free copy to code from numerous books, some already out of date) or they will just copy&paste without understanding what that thing does.
However I use that site time-to-time, but I think I'm past the learning of for or while loops...
I would not recommend that site to beginner because either they will learn nothing from it as it does not contain any explanation to the code (code there is simple free copy to code from numerous books, some already out of date) or they will just copy&paste without understanding what that thing does.
However I use that site time-to-time, but I think I'm past the learning of for or while loops...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the Java Forum
- Previous Thread: java homework help!!
- Next Thread: Please Help Compiling Error



Linear Mode