nikolas_serafini

Lista 3 - Exercício 42

Jun 15th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int first,last,i;
  6.    
  7.     printf("Entre com o intervalo :\n");
  8.     scanf("%d %d",&first,&last);
  9.  
  10.     printf("Intervalo completo :\n");
  11.     for (i = first; i <= last; i++)
  12.     {
  13.         printf("%d ",i);
  14.     }
  15.     printf("\n\n");
  16.  
  17.     printf("Numeros impares :\n");
  18.     for (i = first; i <= last; i++)
  19.     {
  20.         if (i%2 != 0)
  21.         {
  22.             printf("%d ",i);
  23.         }
  24.     }
  25.     printf("\n\n");
  26.  
  27.     printf("Numero impares multiplos de 3 :\n");
  28.     for (i = first; i <= last; i++)
  29.     {
  30.         if ((i%2 != 0)&&(i%3 == 0))
  31.         {
  32.             printf("%d ",i);
  33.         }
  34.     }
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment