Python Program to Read Two Numbers and Print Their Quotient and Remainder














































Python Program to Read Two Numbers and Print Their Quotient and Remainder



Description:
To get the quotient on dividing two numbers in Python, we use the // (integer division) operator.
To get the remainder on dividing two numbers in Python, we use the % (modulus) operator.

Python Code:
class Division: def __init__(self, num1, num2): self.num1 = num1 self.num2 = num2 def get_quotient(self): return self.num1 // self.num2 def get_remainder(self): return self.num1 % self.num2 def main(): num1 = int(input("Enter first number: ")) num2 = int(input("Enter second number: ")) obj = Division(num1, num2) quotient = obj.get_quotient() remainder = obj.get_remainder() print("\nQuotient:", quotient) print("Remainder:", remainder) if __name__ == "__main__": main()

Output:
Enter first number: 20 Enter second number: 3
Quotient: 6 Remainder: 2

More Articles of Siddhartha Dutta:

Name Views Likes
Python MySQL insert record into table 883 0
Python Program to Search the Number of Times a Particular Number Occurs in a List 679 14
GUI based python application to count number of characters 903 3
Python DynamoDB Delete a Table 992 0
Python Program to Check if a String is a Palindrome or Not 635 11
Python Program to Accept Three Digits and Print all Possible Combinations from the Digits 1175 19
Python Program to Display the Nodes of a Linked List in Reverse without using Recursion 725 11
Python DynamoDB Read a Record 824 0
Python Program to Remove the Characters of Odd Index Values in a String 1803 23
Python MySQL select using fetchone method 788 0
Python MySQL sort the result 755 0
Python Program to Find the Binary Equivalent of a Number without Using Recursion 646 15
Python MySQL prevent SQL injection in update 1235 0
Python Program to Interchange the two Adjacent Nodes given a circular Linked List 581 10
Python MySQL where example and usage 1000 0
Python Program to Print an Identity Matrix 689 16
Python Program to Find Those Numbers which are Divisible by 7 and Multiple of 5 in a Given Range of Numbers 646 17
Python Program to Implement Binary Insertion Sort 1004 13
Python Program to Check If Two Numbers are Amicable Numbers 807 17
Python Program to Find the Area of a Rectangle Using Classes 1123 18
Python Program to Find the Total Sum of a Nested List Using Recursion 3162 10
Python Program to Find the Second Largest Number in a List Using Bubble Sort 808 19
Python MySQL prevent SQL injection in select 1964 0
Python MongoDB Select specific fields from collection 1097 10
Python MySQL sort the result in ascending order 785 0
Python Program to Find Number of Occurrences of All Elements in a Linked List 654 16
Python MySQL wildcard select 994 0
Python Program to Check if a Number is a Strong Number 607 20
Python Program to Find the Length of a List Using Recursion 1401 12
Python MySQL create table 862 0
Python Program to Check whether a Singly Linked List is a Palindrome 2034 10
Python DynamoDB Query the Table 1049 0
Python Program that Reads a Text File and Counts the Number of Times a Certain Letter Appears in the Text File 1064 27
Python Program to Find the Second Largest Number in a List 858 16
Python MongoDB Sort the result in descending order 798 10
Python MySQL connector get started 876 10
Python Program to Implement Binary Search without Recursion 1674 22
Python Program to Find All Numbers which are Odd and Palindromes Between a Range of Numbers without using Recursion 879 23
Python MySQL update existing record 789 0
Python Program to Compute Prime Factors of an Integer 730 28
Python MySQL check database exists or not 4525 5
Python Program to solve Maximum Subarray Problem using Kadanes Algorithm 798 18
Python Program to Convert a Binary Tree into a Singly Linked List by Traversing Level by Level 1203 10
Python Program to Find the Sum of First N Natural Numbers 615 19
Python Program to Find the LCM of Two Numbers 819 31
Python Program to Implement Gnome Sort 1077 11
Python MongoDB Creating a Database 885 20
Python Program to Take in a String and Replace Every Blank Space with Hyphen 1321 25
Python Program to Implement Comb Sort 763 10
Python Program to Check if a Date is Valid and Print the Incremented Date if it is 1440 22
Python Program to Read a Number n And Print the Series 1+2+.....+n= 643 28
Python MySQL insert record into table and get inserted ID 709 0
Python Program to test Collatz Conjecture for a Given Number 1490 18
Python Program to Read Two Numbers and Print Their Quotient and Remainder 1562 30
Python Program to Count Number of Lowercase Characters in a String 582 19
Python MongoDB Insert Into Collection and return the _id field 1233 10
Python MongoDB Creating a Collection 979 10
Python MySQL select with a Filter 756 0
Python Program to Find the Binary Equivalent of a Number Recursively 675 20
Python Program to Count the Number of Blank Spaces in a Text File 806 16
Python Program to Sort the List According to the Second Element in Sublist 860 17
Python Program to Remove the nth Index Character from a Non-Empty String 1554 16
Python Program to Count the Number of Vowels in a String 510 23
Python Program to Determine all Pythagorean Triplets in the Range 1965 18
Python Program to Detect if Two Strings are Anagrams 673 22
Python Program to Replace all Occurrences of a with a $ in a String 686 17
Python Program to Determine Whether a Given Number is Even or Odd Recursively 628 14
Python DynamoDB Update an Existing Record 1022 0
Python Program to Implement Shell Sort 884 10
Python Program to Support Infinite Precision Arithmetic & Store a Number as a List of Digits 527 10
Python DynamoDB Create Table 922 0
Python Program to Calculate the Number of Words and the Number of Characters Present in a String 515 19
Python MongoDB Sort the Result 766 10
Python Program to Check String is Palindrome using Stack 2138 14
Python Program to Find the Fibonacci Series Using Recursion 667 28
Python DynamoDB Get Started 897 0
Python Program to Find the Sum of Elements in a List Recursively 614 19
Python Program to Implement Insertion Sort 794 20
Python Program to Upload Files to Your Google Drive 2692 0
Python MongoDB Query Filter the Result 1184 10
Python Program to Read a Text File and Print all the Numbers Present in the Text File 1805 12
Python MySQL insert multiple records into table 898 0
Python Program to Create a Class in which One Method Accepts a String from the User and Another Prints it 829 15
Python Program to Determine How Many Times a Given Letter Occurs in a String Recursively 1175 12
Python Program to Exchange the Values of Two Numbers Without Using a Temporary Variable 552 15
Python DynamoDB Insert Record into Table 802 0
Python Program to Sort using a Binary Search Tree 984 18
Python Program to Find the Fibonacci Series without Using Recursion 2380 27
Python MongoDB Insert Multiple Documents 777 10
Python MongoDB Update Record 991 10
Python Program to Find the Sum of Cosine Series 1913 18
Python Program to Implement Binary Search with Recursion 572 19
Python MongoDB Update Many Records 936 10
Python Program to Find the Factorial of a Number Using Recursion 530 19
Python Program to Take in Two Strings and Display the Larger String without Using Built-in Functions 601 18
Python Program to Get a Function from a C Program File 816 0
Python Program to Find Element Occurring Odd Number of Times in a List 809 20
GUI based Python Program to Count Number of Characters 745 0
Python Program to Find the Largest Number in a List 745 22
Python Program to Flatten a List without using Recursion 891 10
Python Program to Compute a Polynomial Equation given that the Coefficients of the Polynomial are stored in a List 2858 24
Python Program to find the factorial of a number without recursion 1006 27
Python MongoDB Check if Database Exists 1533 10
Python MySQL join two tables 838 0
Python Program to Implement Linear Search 621 24
Python Program to Create a Class and Compute the Area and the Perimeter of the Circle 695 19
Python Program to Check if a Substring is Present in a Given String 570 20
Python Program to Display the Nodes of a Linked List in Reverse using Recursion 1056 13
Python Program to Count Set Bits in a Number 593 15
Python Program to Calculate the Number of Upper Case Letters and Lower Case Letters in a String 2824 21
Python MongoDB Insert Into Collection 842 10
Python Program to Print an Inverted Star Pattern 1240 20
Python Program to Print Sum of Negative Numbers, Positive Even Numbers and Positive Odd numbers in a List 829 11
Python Program to Flatten a Nested List using Recursion 1351 10
Python MySQL limit the number of records in a table 935 0
Python Program to Calculate the Length of a String Without Using a Library Function 620 21
Python MongoDB Check if Collection Exists 7863 10
Python Program to Count the Number of Vowels Present in a String using Sets 865 20
Python MongoDB Insert Multiple Documents, with Specified IDs 743 10
Python DynamoDB Insert Multiple Records into Table 2993 0
Python DynamoDB Delete a Record 1096 0
Python Program to Print the Alternate Nodes in a Linked List using Recursion 852 10
Python Program to Illustrate the Operations of Singly Linked List 844 10
Python Program to Sort a List According to the Length of the Elements 836 18
Python Program to Read the Contents of a File in Reverse Order 918 20
Python MySQL sort the result in descending order 912 0
Python MySQL delete record 727 0
Python Program to Print Odd Numbers Within a Given Range 606 26
Python Program to Generate Random Numbers from 1 to 20 and Append Them to the List 873 26
Python Program to Interchange two Elements of the List without touching the Key Field 604 10
Python Program to Check if Expression is correctly Parenthesized 767 18
Python MongoDB Delete Document 770 10
Python Program to Find the Sum of Sine Series 2514 20
Python Program to Count the Occurrences of Each Word in a Given String Sentence 1215 19
Python Program to Create a Class which Performs Basic Calculator Operations 658 17
Python Program to Form a New String Made of the First 2 and Last 2 characters From a Given String 581 15
Python Program to Check if a String is a Pangram or Not 715 20
Python MySQL select particlular column from table 725 0
Python MongoDB Limit the Result 985 10
Python Program to Append, Delete and Display Elements of a List Using Classes 3400 22
Python MongoDB Select data from collection using find_one method 793 10
Python MongoDB Delete All Documents in a Collection 965 10
Python Program to Form a New String where the First Character and the Last Character have been Exchanged 1434 12
Python Program to Implement Selection Sort 738 10
Python Program to Read a Linked List in Reverse 805 15
Python Program to Clear the Rightmost Set Bit of a Number 954 22
Python Program to Print the Alternate Nodes in a Linked List without using Recursion 562 10
Python Program to Reverse a String without using Recursion 919 28
Python Program to Test Hard Disk Speed 2233 0
Python Program to Find the Sum of All Nodes in a Binary Tree 1597 10
Python Program to Put Even and Odd elements in a List into Two Different Lists 973 20
Python Program to Convert a given Singly Linked List to a Circular List 691 10
Python Program to Read a Number n and Print the Natural Numbers Summation Pattern 713 26
Python MongoDB Get Started 926 21
Python Program to Upload Files to Your Dropbox 1265 0
Python Program to Create a Class and Get All Possible Subsets from a Set of Distinct Integers 975 31
Python Program to Solve Josephus Problem using Linked List 2721 10
Python MongoDB Select all data from collection using find method 1014 10
Python MySQL drop table only if exist 755 0
Python Program to Implement Cocktail Shaker Sort 1257 10
Python Program to Calculate the Number of Digits and Letters in a String 755 13
Python MySQL Order By 732 0
Python DynamoDB Scan the Table 1314 0
Python MySQL prevent SQL injection in delete 916 0
Python Program to Implement Dequeue 720 10
Python Program To Find the Smallest and Largest Elements in the Binary Search Tree 759 10
Python MongoDB Query Filter With Regular Expressions 899 10
Python Program to Implement Priority Queue to Add and Delete Elements 1052 10
Python Program that Displays which Letters are in the First String but not in the Second 625 19
Python MySQL create database 816 11
Python MongoDB Drop Collection 824 10
Python MongoDB Delete Many Documents 1196 10
Python Program to Find the Sum of the Digits of the Number Recursively 650 21
Python Program to Find the Sum of Digits in a Number without Recursion 611 23
Python MySQL drop table 729 0

Comments