Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
45 views
in Computer by (44.9k points)
closed by

Integers and Floats.

1 Answer

+1 vote
by (44.8k points)
selected by
 
Best answer

In Python, integer variables are used to store whole numbers, which can be positive or negative. Quotation marks should not be used while defining integers. Integer variables can be treated like numbers for all mathematical operations. 

If you need to store decimal numbers in Python, you should use float variables as integer variables ignore the decimal part of a number. When you combine a float variable and an integer variable in a mathematical calculation, the resulting answer will always be a float. You can do several arithmetic operations with floats and integers. Let us see some common operations with floats and integers.

  • Addition
  • Subtraction 
  • Multiplication 
  • Division 
  • Modulus (Remainder)

Now that we know what Integers and Floats are, let us now understand the syntax for performing different Mathematical operations on them in our Program

1. Performing Addition of Integers and Floats

x = 1 

y = 2

sum = x + y

2. Performing Subtraction of Integers and Floats

x = 1 

y = 2 

subtraction = x - y

3. Performing Multiplication of Integers and Floats

x = 1 

y = 2 

multiplication = x * y

4. Performing Division of Integers and Floats

x = 1 

y = 2 

division = x / y

5. Performing Modulus of Integers and Floats

x = 1 

y = 2 

modulus = x % y

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...