How to get Remainder value of 2 integers in c#

Hello all, In  this program, we can get the Remainder value of  2 integers in c#


using System;
using System.Collections.Generic;
using System.Text;

namespace testconsole
{
    class Program
    {
      
        static void Main(string[] args)
        {
            Console.WriteLine("Enter First Value");
            int firstvalue =Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter Second Value");
            int secondvalue = Convert.ToInt32(Console.ReadLine());
            int remainder;
            if (secondvalue==0)
            {
                Console.WriteLine("Second value can't be zero");
            }
            else if (firstvalue<secondvalue)
                {
                    Console.WriteLine("First value can't be lessthan second value");
                }
            remainder = (firstvalue % secondvalue);
            Console.WriteLine("Remainder: {0}", remainder);
            Console.ReadLine();
            
        }

    }
}

Comments

Popular posts from this blog

Bootstrap Modal Popup keep open on PostBack in ASP.Net

Resolved Issue in Asp core 3.0 serializersettings does not exist in AddJsonOptions

Dynamic Mega Menu With Asp.Net with c#,java script and Sql Server.