C# Program to Compute Quotient and Remainder

Find quotient and remainder

C# program to compute quotient and remainder has been shown here. Find here the algorithm, pseudocode and time complexity of the program. The flowchart of the problem can be found here.






1. C# Program & output to Compute Quotient and Remainder

Code has been copied
/* *******************************************
           alphabetacoder.com
 C# proram for calculating quotient and remainder 
******************************************* */

using System;

namespace QuotientRemainder
{
    class Program
    {
        static void Main(string[] args)
        {
            //declare and initialize character variable
            int a = 17, b = 5;
            int q, r;

            //find the quotient
            q = a / b;
            //find the remainder
            r = a % b;

            // display result
            Console.WriteLine("When "+a+" is divided by "+b+ ", quotient is "+q+" and remainder is " +r+".");

            // wait for user to press any key
            Console.ReadKey();
        }
    }
}

Output


When 17 is divided by 5, quotient is 3 and remainder is 2.