Advertisement
FoxTuGa

Tab_D - <Old> <Unknown>

May 8th, 2011
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int n1, x, n, nt;
  5.  
  6. int main()
  7. {
  8.     /*Loop infinito para o utilizador fazer multiplas contas*/
  9.     while(1)
  10.     {
  11.     printf("\n\tIntroduza um numero: ");
  12.     fflush(stdin);              //Validação de caracteres
  13.     scanf("%d", &n1);           //Input de dados
  14.     system("cls");              //Limpar o ecran Após os dados serem introduzidos
  15.  
  16.     /*Validação dos numeros entre 1 e 10*/
  17.     if(n1>=1 && n1<=10)
  18.     {
  19.     printf("\n Tabuada do %d\n\n", n1);
  20.     nt=0;
  21.     n=n1;
  22.     x=1;
  23.         /*Loop onde as contas sao efectuadas*/
  24.         do
  25.         {
  26.             nt=n1*x;
  27.             printf("\n %d x %d = %d", n, x, nt);            //Output de dados
  28.             x++;
  29.         }
  30.         while(x<=10);
  31.             printf("\n\n");
  32.     }
  33.    
  34.     else
  35.         printf("\n Introduza um Numero entre 1 e 10\n\n");} //Msg Erro de Valid.
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement