Saturday, April 26, 2025

C# - Math Operations - Max, Min, Abs, Sqrt, Round

using System;

namespace LearnCS
{
    class Program
    {
        static void Main(string[] args)
        {
            float fNumber = 10.56F;
            float sNumber = 12.20F;
            int tNumber = 9;

            Console.WriteLine("Max: " + Math.Max(fNumber, sNumber));
            Console.WriteLine("Min: " + Math.Min(fNumber, sNumber));
            Console.WriteLine("Sqrt: " + Math.Sqrt(tNumber));
            Console.WriteLine("Abs: " + Math.Abs(-45));
            Console.WriteLine("Round: " + Math.Round(5.55));
            Console.WriteLine("Round: " + Math.Round(5.2));

            Console.ReadLine();
        }
    }        
}

 

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 .  ...