Advertisement
Guest User

Case

a guest
May 19th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. programa
  2. {
  3.     funcao inicio()
  4.     {
  5.        
  6. inteiro opc, num
  7.  
  8.         escreva("Entre com o valor a ser testado: ")
  9.         leia(num)
  10.  
  11.         escreva("Você pretende identificar se o numero é: ")
  12.         escreva("\n1 - Par ou impar:")
  13.         escreva("\n2 - Positivo, negativo ou 0:")
  14.         escreva("\n3 - Ano bissexto:\n")
  15.         leia(opc)
  16.  
  17.         escolha(opc)
  18.         {
  19.             caso 1:
  20.  
  21.             se(num % 2 == 0){
  22.                 escreva("O numero é par!")
  23.             }senao{
  24.                 escreva("O numero é impar!")
  25.             }
  26.             pare
  27.  
  28.             caso 2:
  29.                 se(num == 0){
  30.                     escreva("Numero é igual a 0!")
  31.                 }senao se(num > 0){
  32.                     escreva("Numero é maior que 0!")
  33.                 }senao{
  34.                     escreva("Numero menor que 0!")
  35.                 }
  36.             pare
  37.  
  38.             caso 3:
  39.                 se((num % 400 == 0) ou (num % 4 == 0 e num % 100 != 0)){
  40.                     escreva("Ano bissexto!")
  41.                 }senao{
  42.                     escreva("Ano não é bissexto!")
  43.                 }
  44.             pare
  45.            
  46.             caso contrario:
  47.                 escreva("Opção inválida!")
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement