# Thread: Multiplication table (need guide)

1. ok.! understand now..
thank u very much!!!
Code:
```  for ( i = x; i <= x + 3; i++ )  {
printf("\t%d", i);
for ( j = 2; j <= 5; j++ ){
printf("\t%d", i*j);
}
printf( "\n" );
}```
correct aite? : ))
so now.. should i use while or for to control my input?

2. so now.. should i use while or for to control my input?
It doesn't really matter which loop you use. If you keep asking questions without trying anything out for yourself, you will never learn. Like I said, Think about it and write some code, after that if you get stuck try to figure out why you are getting stuck. Dont just jump to posting the moment your done writing your code. You might be able to solve the problem faster if you try it yourself and youll learn something in the process too.

3. ok.. i'll try it first... until i dont know wut should i do..
thanks guys.. =)

4. Originally Posted by Spidey
It doesn't really matter which loop you use. If you keep asking questions without trying anything out for yourself, you will never learn. Like I said, Think about it and write some code, after that if you get stuck try to figure out why you are getting stuck. Dont just jump to posting the moment your done writing your code. You might be able to solve the problem faster if you try it yourself and youll learn something in the process too.
I agree, that would be a pretty good advice. Remember that in developing an application, planning is the longest part. You have to think first, analyze the problem.

5. guys.. i got stuck again..
hurmm..~

Code:
```printf("Enter a number between 1 to 20 (1-20): ");
scanf("%d", &x);

for ( i = x; i <= x + 3; i++ )  {
printf("\t%d", i);
printf("\t|");

for ( j = x; j <= x+3; j++ ){
printf("\t%d", i*j);
}
printf( "\n" );
}
OUTPUT
Enter a number between 1 to 20 (1-20): 2
2       |       4       6       8       10
3       |       6       9       12      15
4       |       8       12      16      20
5       |       10      15      20      25
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
i want my output to be like below:
Enter a number between 1 to 20 (1-20): 2
|      2       3        4        5
---------------------------------------------
2       |       4       6       8       10
3       |       6       9       12      15
4       |       8       12      16      20
5       |       10      15      20      25```
how am i going to print | 2 3 4 5
---------------------------------------------

6. how am i going to print | 2 3 4 5
I think you'll find that you've pretty much already done that if you look back one page.

7. Originally Posted by Spidey
I think you'll find that you've pretty much already done that if you look back one page.
i've try for so many times... but still cant get it..

Popular pages Recent additions