Showing posts with label if - else statement in C#. Show all posts
Showing posts with label if - else statement in C#. Show all posts

Sunday, June 19, 2016

If Else Statement in C#

This sample program written in C# will show you how to use if else statement this sample program is being provided by my good friend and fellow programmer Mr. Dave Marcellana.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.


Program Listing

if-else.cs

using System;

public class if-else
{
    public static void Main()
    {
        int n;
        for(n=0; n<21; n++)
        {
            if(n == 0)
            {
                Console.WriteLine("First one: " + n);
            }
            else if(n < 5)
            {
                Console.WriteLine("Less than five: " + n);
            }
            else if(n == 10 || n == 11)
            {
                Console.WriteLine("Ten or Eleven: " + n);
            }
            else if(n >= 13 && n <= 18)
            {
                Console.WriteLine("YEHEY!!");
            }
            else
            {
                Console.WriteLine("Not less than five: " + n);
            }
        }
    }
}