C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C#

Please help... how do I write if statements for an equation that states "A divided by B the reminder 0 or 1"

6th Dec 2020, 3:33 PM
Nyaxie
4 Answers
+ 2
Nyaxie Modulus operator (%) will help you. A%B returns reminder
6th Dec 2020, 3:37 PM
A͢J
A͢J - avatar
+ 2
Nyaxie Doesn't it looks like a homework QUESTIOn? I think it's the same!
7th Dec 2020, 7:09 AM
Piyush
Piyush - avatar
+ 1
Nyaxie int A = Convert.ToInt32(Console.ReadLine()); int B = Convert.ToInt32(Console.ReadLine()); try { Console.Write("Reminder = " + A % B); } catch(Exception e) { Console.Write("B can't be 0"); }
6th Dec 2020, 3:46 PM
A͢J
A͢J - avatar
0
AJ #Learn With Me 👨‍💻 okay thank you. Can you help me with the right codes to use for it to run well
6th Dec 2020, 3:39 PM
Nyaxie