

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Math.DivRem Method
Use the Math.DivRem method to calculate the quotient of two numbers and return the remainder.
Firstly, set dividend and divisor.
// dividend long dividend = 30; // divisor long divisor = 7;
Now, use the DivRem method.
long quotient = Math.DivRem(dividend, divisor, out rem);
Example
using System; using System.Globalization; class Demo { static void Main() { // remainder long rem; // dividend long dividend = 98; // divisor long divisor = 9; long quotient = Math.DivRem(dividend, divisor, out rem); Console.WriteLine("{0} \\ {1} = {2} and remainder = {3}", dividend, divisor, quotient, rem); } }
Output
98 \ 9 = 10 and remainder = 8
- Related Questions & Answers
- Math.DivRem() Method in C#
- C# int.Parse Method
- C# OfType() Method
- C# ToTuple() Method
- C# Aggregate() method
- C# All method
- C# Truncate Method
- C# String.PadLeft Method
- C# int.TryParse Method
- C# Convert.ToInt32 Method
- C# Single() Method
- C# SingleorDefault() Method
- C# Any Method
- C# Average Method
- C# Cast method
Advertisements