Results 1 to 6 of 6
Thread: hi
- 09-30-2008, 09:32 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 3
- Rep Power
- 0
- 09-30-2008, 09:41 PM #2
Member
- Join Date
- Sep 2008
- Posts
- 3
- Rep Power
- 0
this doesnt work why?
class Stars {
public static void main (String [] args) {
for (int x = 1; x< x; ); {
if (x <= 5)System.out.println ("* ");
else if (x <=)System.out.println (" *");
else if (x <=)System.out.println ("* ");
else System.out.println (" *");
If(x%5 ==0)System.out.println();
}
}
}
-
1) Welcome to the forum.
2) When posting your code, please use code tags so that your code will retain its formatting and be readable. To do this, you will need to paste already formatted code into the forum, highlight this code, and then press the "code" button at the top of the forum Message editor prior to posting the message. You may want to click on the Preview tab to make sure that your code is formatted correctly. Another way is to place the tag [code] at the top of your block of code and the tag [/code] at the bottom.
3) If your program is not compiling then it is always good to post the error messages that the compiler is giving you, and indicate in your program what line is throwing the error (the error message will give the line number, but this will have meaning for you who has the full source code, and has no meaning for us).
4) What are you trying to do with statement such as
Java Code:if (x <=) ....
5) Always enclose if / else / for / while / and other blocks in curly braces, even if the statement is only one line long. This will save you from grief in the future.
- 10-03-2008, 09:19 PM #4
Member
- Join Date
- Sep 2008
- Posts
- 3
- Rep Power
- 0
new problem
never mind that code i need this one fixed
Java Code:class Addition { //main method begins execution of java aplication public static void main (String args[]) { [COLOR="DarkOrchid"]Scanner input = new Scanner (System.in);[/COLOR] int number1; int number2; int sum; System.out.println("enter first integer: "); number1 = input.nextInt(); System.out.println("enter second integer: "); number2 = input.nextInt(); sum = number1 + number2; System.out.printf("Sum os %d\n" , sum); } }
- 10-03-2008, 09:28 PM #5
What is the problem?
Copy all of error message text here.
-
Bookmarks