Guest User

Untitled

a guest
Jul 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Ej6
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int año,res400,res100,res4;
  13.  
  14.             Console.WriteLine("Ingrese el año");
  15.             año = int.Parse(Console.ReadLine());
  16.  
  17.             res400 = año % 400;
  18.             res100 = año % 100;
  19.             res4 = año % 4;
  20.  
  21.             if (res100 == 0 && res400 != 0)
  22.             {
  23.                 Console.WriteLine("El año {0} no es bisiesto", año);
  24.             }
  25.  
  26.             else
  27.             {
  28.                 if (res400 == 0)
  29.                     Console.WriteLine("El año {0} es bisiesto", año);
  30.                 else
  31.                 {
  32.                     if (res4 == 0)
  33.                         Console.WriteLine("El año {0} es bisiesto", año);
  34.                     else
  35.                         Console.WriteLine("El año {0} no es bisiesto", año);
  36.                 }
  37.             }
  38.  
  39.             Console.ReadKey();
  40.  
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment