Table 2 to 20

Discussion in 'C' started by riz09, May 10, 2009.

  1. riz09

    riz09 New Member

    Joined:
    May 7, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    hi all... thanx my dear Saswatpadhi for helping me... thnx alot..
    i have headache due to my this problem.. hope u can help me..

    i have to print tables from 2 to 20 in order that once a table is viewed.. then a message displays that Press any key to continue.. then if i press any key then the next table displays..

    till now i can only print 2 to 20 tables but i didnt control over this message that Press any key to continue..
    it makes some errors.. so please kindly help me...
    -----
    Raza Elahi
     
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
    There are two ways to display the message :

    (1) Through the console :
    Code:
    system("pause");  // use #include <stdlib.h>
    (1) Through C or C++ :
    Code:
    printf("Press any key to continue ...\n");
    getchar();
    So, the final code will be :
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main()
    {
          int Cnt, X;
          for(Cnt = 2; Cnt < 21; ++Cnt)
          {
                for(X = 1; X< 11; ++X)   // The table
                      printf("%d * %d = %d\n", Cnt, X , Cnt*X);
                putchar(10);  // print a newline
                system("pause");
                putchar(10);  // print a newline
          }
          return 0;
    }
     
    Last edited: May 10, 2009
    shabbir likes this.
  3. riz09

    riz09 New Member

    Joined:
    May 7, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Thanx.. i use ur first code.. nd it works.. thank u
     
  4. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
    As shabbir says, "The pleasure is all mine" ! :smile:
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    haha :D
     
  6. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    I know this isn't what anyone wants to hear but if you keep giving riz09 completed code he'll keep being dependent instead of learning for himself how to program. This is a REALLY EASY task he should have been able to figure out for himself.

    riz09: by all means ask for help, but completed examples don't help you. When you get to the exam where you can't ask on go4expert, you'll be completely stuck and will fail the exam. Have a go instead of posting here, and ask for help with what you're stuck on.

    The problem of course is that your assignments will get increasingly difficult so you need to break this dependency cycle as soon as possible.
     
  7. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
    Never thought about it this way, but :iagree:.
    Next time, show us your progress first and then we will help. We won't do your homework here.
     
  8. riz09

    riz09 New Member

    Joined:
    May 7, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    u all r right but my dear friends.. i m a hard worker.. u knw daily i do miscellaneous projects nd sometimes i got success but sometimes i lose.. thats y i try again nd again.. but i m only here to sort out whats missing in my program.. what problem i m facing.. i m only here to ask u all.. bcoz this is the portal where v can share our problems regarding programming....

    Actually in our college there's not a teacher of ICP (introduction to computer programming) thats y i m facing these problems as exams is near..

    To Mr. Admin..

    am i having a right to post here my problems or faces this type of posts..?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice