ramontricolor12

LISTA 03 - Exercício 11

Jun 15th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. /* CABEÇALHO
  2.    Arquivo: LISTA 03 - Exercicio 11.c
  3.    Objetivo: Verificar se um número é primo.
  4.    Autor(a): Ramon Borges
  5.  */
  6.  
  7. #include <stdio.h>
  8.  
  9. int main()
  10. {
  11.     int num;
  12.  
  13.     printf("\nInforme um numero: ");
  14.     scanf("%d", &num);
  15.  
  16.     if(num % 2 != 0)
  17.         if(num % 3 != 0)
  18.             if(num % 5 != 0)
  19.                 if(num % 7 != 0)
  20.                     printf("\nEsse numero e primo!!!");
  21.                 else
  22.                     printf("\nEsse numero nao e primo.");
  23.             else
  24.                 printf("\nEsse numero nao e primo.");
  25.         else
  26.             printf("\nEsse numero nao e primo.");
  27.     else
  28.         printf("\nEsse numero nao e primo.");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment