Thread: Multiplication table (need guide)

  1. #16
    Registered User
    Join Date
    Jul 2009
    Location
    Malaysia, Cyberjaya
    Posts
    38
    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. #17
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    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. #18
    Registered User
    Join Date
    Jul 2009
    Location
    Malaysia, Cyberjaya
    Posts
    38
    ok.. i'll try it first... until i dont know wut should i do..
    thanks guys.. =)

  4. #19
    Registered User
    Join Date
    Jul 2009
    Posts
    40
    Quote Originally Posted by Spidey View Post
    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. #20
    Registered User
    Join Date
    Jul 2009
    Location
    Malaysia, Cyberjaya
    Posts
    38
    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. #21
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    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. #22
    Registered User
    Join Date
    Jul 2009
    Location
    Malaysia, Cyberjaya
    Posts
    38
    Quote Originally Posted by Spidey View Post
    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 subscribe to a feed

Similar Threads

  1. Multiplication table
    By freddyvorhees in forum C++ Programming
    Replies: 6
    Last Post: 08-02-2008, 11:09 AM
  2. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 05:06 PM
  3. multiplication table
    By SpEkTrE in forum C Programming
    Replies: 2
    Last Post: 12-09-2003, 04:46 PM
  4. C++ Multiplication Table Generator
    By Visual Develope in forum C++ Programming
    Replies: 4
    Last Post: 05-15-2002, 11:22 AM
  5. Multiplication Table Error
    By Okiesmokie in forum C++ Programming
    Replies: 3
    Last Post: 01-10-2002, 03:31 PM