C# program to print even numbers
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter number");
int number = 0;
number = int.Parse(Console.ReadLine());
for (int i = 0; i <= number; i++)
{
if (i % 2 == 0)
{
Console.WriteLine(i);
Console.WriteLine("even number");
}
else
{
Console.WriteLine(i);
Console.WriteLine("odd number");
}
}
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter number");
int number = 0;
number = int.Parse(Console.ReadLine());
for (int i = 0; i <= number; i++)
{
if (i % 2 == 0)
{
Console.WriteLine(i);
Console.WriteLine("even number");
}
else
{
Console.WriteLine(i);
Console.WriteLine("odd number");
}
}
Console.ReadLine();
}
}
}
Comments