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

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

Bootstrap Modal Popup keep open on PostBack in ASP.Net

Export div content to PDF Using ITextSharp in asp.net