-
-
Save parzibyte/279d1bd80b7c9445e35b4e3bc115ca25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ParImpar | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// https://parzibyte.me/blog | |
Console.WriteLine("Escribe un número: "); | |
long numero = Convert.ToInt64(Console.ReadLine()); | |
long sobrante = numero % 2; | |
if (sobrante == 0) | |
{ | |
Console.WriteLine("El número es par"); | |
} | |
else | |
{ | |
Console.WriteLine("El número es impar"); | |
} | |
SinModulo(); | |
} | |
static void SinModulo() | |
{ | |
Console.WriteLine("Escribe un número: "); | |
long numero = Convert.ToInt64(Console.ReadLine()); | |
long sobrante = numero & 1; | |
if (sobrante == 0) | |
{ | |
Console.WriteLine("El número es par"); | |
} | |
else | |
{ | |
Console.WriteLine("El número es impar"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment