fork(2) download
  1. using static System.Console;
  2.  
  3. public class Program {
  4. public static void Main() {
  5. Compara(20, 15);
  6. Compara(20, 14);
  7. Compara(20, 11);
  8. Compara(20, 8);
  9. Compara(20, 2);
  10. }
  11. private static void Compara(int aniversario, int ano) {
  12. var idade = aniversario - ano;
  13. string texto;
  14. if (idade < 6) texto = "Infatil A";
  15. else if (idade < 7) texto = "Infantil B";
  16. else if (idade < 10) texto = "Juvenil A";
  17. else if (idade < 13) texto = "Juvenil B";
  18. else if (idade > 17) texto = "Adulto"; //e os que estão entre 13 e 17 não existem?
  19. else texto = "Não existe categoria";
  20. WriteLine(texto);
  21. }
  22. }
  23.  
  24. //https://pt.stackoverflow.com/q/386515/101
Success #stdin #stdout 0s 131520KB
stdin
Standard input is empty
stdout
Infatil A
Infantil B
Juvenil A
Juvenil B
Adulto