w3resource

C#: Print the result of dividing two numbers


Divide Two Numbers

Write a C# Sharp program to print the result of dividing two numbers.

Division is one of the four basic operations of arithmetic, the others being addition, subtraction, and multiplication. The division of two natural numbers is the process of calculating the number of times one number is contained within one another.

C# sharp Exercises: dividing two numbers

Sample Solution:

C# Sharp Code:

// This is the beginning of the Exercise3 class
public class Exercise3
{
    // This is the main method where the program execution starts
    public static void Main()
    {
        // This line performs division of 36 by 6 and outputs the result to the console
        System.Console.WriteLine(36 / 6);
    }
}

Sample Output:

6

Flowchart:

Flowchart: C# Sharp Exercises - Print the result of dividing two numbers

For more Practice: Solve these Related Problems:

  • Write a C# program that divides two integers, prints both the quotient and remainder, and determines if the division is exact.
  • Write a C# program that divides two double values but validates and rejects division by zero before processing.
  • Write a C# program that takes two numbers and returns the reciprocal of the quotient if the quotient is greater than 1.
  • Write a C# program to divide two numbers and output the result with 5 digits after the decimal point.

Go to:


Previous: Sum of Two Numbers.
Next: Specified Operations Results.

C# Sharp Code Editor:



What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.