Advertisement
FoxTuGa

1 to N pare - <Old>

May 8th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int num;
  4. int x, ct;
  5.  
  6. int main()
  7. {
  8.     printf("\nIntroduza um Numero: ");
  9.     fflush(stdin);
  10.     scanf("%d", &num);
  11.  
  12.     for(x=1;x<num;x++)
  13.         if(x%2==0)
  14.         {
  15.             printf("\n%d", x);
  16.             ct++;
  17.         }
  18.  
  19.     printf("\n\nQuantidade de Numeros pares entre 1 e %d: %d\n\n", num, ct);
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement