1.5 Division

Question


Write a program which accept two numbers, perform Division and print Quotient and Remainder.

Solution


class Division
    {
        static void Main(string[] args)
        {
            int a, b, c, d;                               //initialization
            Console.Write(“Enter first number : “);
            a = Convert.ToInt16(Console.ReadLine());
            Console.Write(“Enter second number : “);
            b = Convert.ToInt16(Console.ReadLine());
            c = a / b;                                //calculation for quotient
            d = a % b;                                //calculation for remainder
            Console.WriteLine(“Quotient = “ + c);
            Console.WriteLine(“Remainder = “ + d);    
        }
    }

 Previous                                                Home                                                   Next


Output

5