Writing a code that that shows quotient and remainder separately. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

29th Jul 2016, 1:36 PM
Mystic Ash
Mystic Ash - avatar
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);
29th Jul 2016, 1:48 PM
Gabriel “zogglerplays” Schwienbacher
Gabriel “zogglerplays” Schwienbacher - avatar