Pages

Saturday

Program for Printing Addition Table of the Given Number in C

Here's a program for printing addition table of the given number using for loop in C programming language.


# include <stdio.h> 
# include <conio.h> 
void main() 
{ 
 int i, t, n ; 
 clrscr() ; 
 printf("Enter the table : ") ; 
 scanf("%d", &t) ; 
 printf("\nEnter the limit : ") ; 
 scanf("%d", &n) ; 
 printf("\nThe table is :\n\n") ; 
 for(i = 1 ; i <= n ; i++) 
  printf("%4d + %4d = %4d\n", i, t, i + t) ; 
 getch() ; 
} 

2 comments:

  1. Hola,

    I learnt so much in such little time about Program for Printing Addition Table of the Given Number in C. Even a toddler could become smart reading of your amazing articles.

    I'm doing a small tool. I compile the code with gcc in MingW.

    One of its windows has a lot of normal controls on it (comboboxes, editboxes, textboxes, groupboxes...).
    I'm trying to reduce the window flickering (when modifying the controls) by using this code:

    Code:
    //button click event
    SetWindowRedraw(hWnd,FALSE);

    //do a lot of modifications (hide/show/move/edit controls with their repaint disabled)

    SetWindowRedraw(hWnd,TRUE);
    //here I get the rect of the update region
    RedrawWindow(hWnd, &updrect, 0, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_UPDATENOW);

    It flickers a little less, but it can be improved.
    Is there a way?

    I know about "double buffered", implemented in Delphi successfully but couldn't find a way in C.

    I look forward to see your next updates.

    Obrigado,
    Irene Hynes

    ReplyDelete