Skip to main content

Arithmetic operator in python| Python arithmetic operator| Arithmetic operator| Operators in python| python for beginner

Hello reader's, 
In this post you are going to see about Arithmetic operator in python . 





Arithmetic operator is basically performs four types of function that is Addition, Subtraction, Multiplication and Division. In this post you will see how you can perform these operations using python. To perform these operation you don't have to install any modules.
Addition :- 
In addition operation you are going to add two number using python, for adding two number you have to take input from user , to take input from user type the code given below- 
A = int(input("Enter number A: "))  This line of code is going to take first input from user and 
B = int(input("Enter another number B: "))  this line of code is going to take second input from user.
print("The addition of A and B is: ", A+B) This line code is going to add the numbers taken as a input from user and also going to print the output.
Subtraction :-  In subtraction you have to take input from user and subtract it, as previously done in addition we have take input from user to take input from user type the code given below or just copy and paste in your IDE
A = int(input("Enter number A: ")) This line of code is going to take first input from user and
B = int(input("Enter another number B: "))  this line of code is going to take second input from user.
print("The subtraction of A and B is: ", A-B) This line code is going to subtract the numbers taken as a input from user and also going to print the output.
Multiplication :-
 As we have done in addition and subtraction we have to take two input from user and multiply it and print the output.
To take input from user type the code given below or just copy and paste in your IDE
A = int(input("Enter number A: ")) This line of code is going to take first input from user and
B = int(input("Enter another number B: "))  this line of code is going to take second input from user.
print("The subtraction of A and B is: ", A*B) This line code is going to Multiply the numbers taken as a input from user and also going to print the output.
Division :-
 Now for the last time we have to take two input from user and perform the division operation .
To take input from user type the code given below or just copy and paste in your IDE
A = int(input("Enter number A: ")) This line of code is going to take first input from user and
B = int(input("Enter another number B: "))  this line of code is going to take second input from user.
print("The subtraction of A and B is: ", A/B) This line code is going to Divide (A/B) the numbers taken as a input from user and also going to print the output.






Code :- 
#Addition
A = int(input("Enter number A: "))
B = int(input("Enter another number B: "))
print("The addition of A and B is: ", A+B)

#Subtraction
A = int(input("Enter number A: "))
B = int(input("Enter another number B: "))
print("The subtraction of A and B is: ", A-B)

#Multiplication
A = int(input("Enter number A: "))
B = int(input("Enter another number B: "))
print("The Multiplication of A and B is: ", A*B)

#Division
A = int(input("Enter number A: "))
B = int(input("Enter another number B: "))
print("The Division of A and B is: ", A/B)

Comments

Popular posts from this blog

ChatGPT| Advantages| Disadvantages| How to use ChatGPT

  What is Chat GPT? ChatGPT is a cutting-edge language model developed by OpenAI that has been trained on a massive corpus of text data from the internet. It uses a neural network architecture that allows it to understand and generate human-like responses to a wide range of prompts, from simple questions to complex conversations. At its core, ChatGPT is designed to replicate the experience of talking to a human being, while also leveraging the power of artificial intelligence to provide fast, accurate, and personalized responses. Unlike traditional chatbots that rely on pre-programmed responses, ChatGPT can generate responses on the fly based on the context of the conversation and the user's input. One of the key advantages of ChatGPT is its versatility. It can be used in a wide range of applications, from customer service and tech support to education and entertainment. For example, a company might use ChatGPT to provide customers with instant answers to their questions, while a t...

S.Y.I.T Sem 3 Python Practical | Python| Python practical 1a| Print name and age +100 | python for beginner

 Hello reader's , This blog is for those students who are studying in second year of information technology. This blog is for practical of python  subject which is in sem 3. In this blog you are going to see that how you can ask user to enter their name and age. Print out a message addressed to them that tells them the year that they will turn 100 year old. For performing this practical you must have install python on your laptop or pc. to download python  - https://www.python.org/downloads/  python website  go to the link and download python and you need a IDE which supports python,  i am using VS Code, you can use python IDE too.  vs code screen After the successful installation open ide and type the code or simply copy the code from given link in below and run it to see the output. code -  name = input("Enter your name: ") age = int(input("Enter your age: ")) year = str((2021 - age)+100) print(name + "will be 100 years old in the year"+year)

Print calendar using python | Python| Calendar using Python |python for beginner

Hello readers, Today, we are going to see that how can we print the calendar using python.   Print calendar using python  In this blog you are going to see that how can you print calendar using python programming language. To perform this activity you must know the basics of python because we are going to use python programming language.   To perform this activity you must have to install python on your laptop or desktop. If you don't know that how to install python then follow these steps.    To install python perform the following steps :- 1) Go to - https://www.python.org/downloads/  2) click "Download" . 3) Download the any latest python version from the given website . 4) When download complete just open your file explorer and double click on downloaded python file and install the python in which directory you want.  5) After the successful installation just double click on python icon on desktop to open python IDE.  python logo  Af...