Oh. btw admin! sorry about my earlier thread. i promise not to do something like that ever again :)

anyway. i was having trouble with my project and its about Multiplication with loops.
i started with a few codes and im really frustrated with what im doing now. please let mee fix this stuff i dont really know about looping statements @---@. thanks

heres tha code.

import java.io.*;

	public class Multiplied{

		public static void main(String [] args){

	BufferedReader buffer= new BufferedReader(new InputStreamReader(System.in));

	int i;
	int j;

	try{

	{System.out.println("Enter a number: ");
	i = integer.parseInt(num.readLine());
	}


	for (int i=1; i<=maxNo; ++i) {
	int sum = 0;
	for (int j=1; j<=maxNo; ++j) {
	sum +=i;
	System.out.print( sum + " " );
	}
	System.out.println();
	


}
catch(IOException e){
System.out.println("ERROR");
}
}

thanks again!

You set i on line 15, but then overwrite that on line 19 without having ever used the first value!
Replace line 31 with e.printStackTrace(); so that you know exactly what the error was and exactly where it happened

oh sorry. thanks for your reply. i will PM you the exact point of the program, because i think its not allowed in here lol. are you saying that i should put

int i=1;
int j;
try{

{System.out.println("Enter a number: ");
i = integer.parseInt(num.readLine());
}


for (int i=1; i<=maxNo; ++i) {
int sum = 0;
for (int j=1; j<=maxNo; ++j)

im really sory. but the fields of looping is not really my place :(

No. don't PM. That's against DaniWeb rules. We can discuss all this in public so everybody else can contribute. (I assume it's not illegal or anything!)
There's no rule against posting your requirements, in fact its hard to help without them. What is bad is posting the requirement while showing no effort. You've posted your code, so that's OK.

Okay. thanks for reminding. so here it is. maybe i can add you on skype? :D

here

2. Create a multiplication table that accept the size of the multiplication table and output it based on the input size.

Sample Input: 2
Sample output:
1 2
2 4

Sample input: 10
Sample output:
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
5 10 15 20 25 30 35 40 45 50
6 12 18 24 30 36 42 48 54 60
7 14 21 28 35 42 49 56 63 70
8 16 24 32 40 48 56 64 72 80
9 18 27 36 45 54 63 72 81 90
10 20 30 40 50 60 70 80 90 100

Sorry, no Skype, no IM, no Twitter, no EMail. I'm here on the forums, that's all.
Anyway, it looks like maxNo in your code corresponds to the 2 and the 10 in your samples, so when you prompt the user to enter a number that's where you need to store his answer.

im working on it. ill post the progress later

oh thanks again for those notes. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.