Advertisement
FoxTuGa

Calcular N to... - <Old>

May 8th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int numI;
  4. int x;
  5. int cnt;
  6. char r;
  7.  
  8. int main()
  9. {
  10.     while(1)
  11.     {
  12.     //Input
  13.     printf("\nIntroduza um Numero: ");
  14.     fflush(stdin);
  15.     scanf("%d", &numI);
  16.     /////
  17.  
  18.     //Ciclo principal
  19.     printf("\n");
  20.     for(x=1;x<=numI;x++)
  21.         if(x%3==0)
  22.         {
  23.             printf("%d\n", x);
  24.             cnt++;
  25.         }
  26.     /////
  27.  
  28.     printf("\nQuantidade de Numeros Multiplos de 3 ate %d: %d\n\n", numI, cnt);
  29.  
  30.     //Repetição do ciclo
  31.     printf("\nRepetir? y/n ");
  32.     fflush(stdin);
  33.     scanf("%c", &r);
  34.     if(r=='y'||r=='Y')
  35.         continue;
  36.     if(r=='n'||r=='N')
  37.         break;
  38.     /////
  39.     }
  40.     printf("\n\n");
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement