Números pares e impares

using System; namespace exercises { class MainClass { public static void Pares (int x , int y) { int z; for( z = x ; z < y; z++) { if (z % 2 == 0) Console.WriteLine(z +" es par"); } } public static void impares(int x , int y) { int z; for( z = x ; z < y; z++) { if (z % 2 != 0) Console.WriteLine(z +" es impar"); } } public static void Main (string[] args) { Pares (1, 100); Console.WriteLine ("\n se acaban los pares \n"); impares (1, 100); } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.