Pascal Code to Divide Two Numbers Using Different Methods
Pascal Code to Divide Two Numbers Using Different Methods
In this tutorial, we will discuss “Pascal Code to Divide Two Numbers Using Different Methods.”
You want to see different ways of dividing two numbers in Pascal. Let’s go step by step with a few approaches.
In this article, we use 4 different ways to divide two numbers.

Real division using “/” operator
In this program, we are using the normal division (/) operator with a variable
Program 1
//division of two numbers
//simple division
program DivTwoNumbers;
var num1,num2:Integer;
result:real;
begin
writeln ('Simple division using "/" operator');
num1:=50;
num2:=10;
result:=num1/num2;
writeln('Result = ', result:0:2)
end.
When the above code is executed, it produces the following result
Simple division using "/" operator Result = 5.00
Divide two numbers using “Div” operator
Program 2
In this program, we are using the “Div ” operator to divide two numbers
//division of two numbers
//simple division
program DivideTwoNumbers;
var num1,num2,quotient:Integer;
begin
writeln ('divide two numbers using "Div" operator');
num1:=90;
num2:=15;
quotient:=num1 div num2;
writeln('Quotient= ', quotient)
end.
When the above code is executed, it produces the following result
divide two numbers using "Div" operator Quotient= 6
Divide two numbers using “Mod” operator
Program 3
In this program, we are using the “Mod ” operator to divide two numbers
//Find remainder using mod
program DivideTwoNumMod;
var num1,num2,remainder:Integer;
begin
writeln ('Find remainder using "mod" operator');
num1:=50;
num2:=18;
remainder:=num1 mod num2;
writeln('Remainder =', remainder);
end.
When the above code is executed, it produces the following result
Find remainder using "mod" operator Remainder =14
divide two numbers using “Div” and “mod” operator
Program 4
In this program, we are using the “Div ” and “mod” operator to divide two numbers
//Find quotient and remainder using mod
program DivideTwoNumMod;
var num1,num2,quotient,remainder:Integer;
begin
writeln ('Find quotient and remainder using "mod" operator');
num1:=50;
num2:=18;
quotient:=num1 div num2;
remainder:=num1 mod num2;
writeln('quotient =', quotient);
writeln('Remainder =', remainder);
end.
When the above code is executed, it produces the following result
Find quotient and remainder using "mod" operator quotient =2 Remainder =14
Similar post
Find product of two numbers using method in Java
Find product of two numbers using recursion in Java
Multiply two numbers in C language
Multiply two numbers in C++ language
Multiply two numbers in Python language
C Program to Divide of two integer numbers
Java Program to Divide of two integer numbers
C++ Program to Divide of two integer numbers
Python Program to Divide of two integer numbers
How to divide two numbers in Java – 5 ways
Java code to Add two numbers – 5 ways