Saturday, April 26, 2025

C# - if..else if..else

using System;

namespace LearnCS
{
    class Program
    {
        static void Main(string[] args)
        {

            if (25 > 50) {
                Console.WriteLine("25 is G reater than 50");
            }
            if (25 < 50) {
                Console.WriteLine("25 is Smaller than 50");
            }
            if (25 == 25)
            {
                Console.WriteLine("Numbers are Equal");
            }

        }
    }        
}
using System;

namespace LearnCS
{
    class Program
    {
        static void Main(string[] args)
        {
            if (100 > 50) {
                Console.WriteLine("100 is Greater than 50");
            }
            if (25 < 50) { 
                Console.WriteLine("25 is Smaller than 50");
            }
            if (50 == 50) {
                Console.WriteLine("Number are Equal");
            }

        }
    }        
}
using System;

namespace LearnCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 50;
            int y = 50;

            if (x > y)
            {
                Console.WriteLine(x + " is Greater than " + y);
            }
            else if (x < y)
            {
                Console.WriteLine(x + " is Smaller than " + y);
            }
            else {
                Console.WriteLine("Numbers are Equal");
            }
        }
    }        
}

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...