**New course!**Every coder should learn

**Generative AI!**

0

# Writing a code that that shows quotient and remainder separately.

pls someone help me write a code that takes user input of dividend and divisor to perform division and shows quotient and remainder in output. Thank u

1 Answer

0

Your code could look like this in the main:
Console.Write("dividend: ") ;
int divident = int.Parse(Console.ReadLine());
Console.Write("divisor: ");
int divisor = int.Parse(Console.ReadLine());
int remainder = divident % divisor;
int quotient = divident / divisor /*important: the type has to be int because it cuts off any decimals! */
Console.WriteLine("The quotient is {0} and the remainder is {1}",quotient,remainder);