write a program to perform mathematical operation addition subtraction multiplication division on the given numbers and operator plus minus divide asterisk will be inputted by the users
Answers
Answer:
from numpy import *
lst = [ ]
o = input('Enter operation name (Addition, Subtraction, Multiplication, Division): ')
o = o.strip()
o = o.lower()
if o == 'addition':
c = int(input('How many numbers do you want to add? '))
for i in range(c):
num = int(input('Enter a number: '))
sum+=num
print('The sum is: ', sum)
elif o == 'subtraction':
s1 = int(input('Enter 1st number: '))
s2 = int(input('Enter 2nd number: '))
print('Difference between', s1, 'and', s2, 'is', s1-s2)
elif o == 'multiplication':
x = int(input('How many numbers do you want to multiply? '))
for i in range(x):
n = int(input('Enter a number: '))
lst.append(n)
for i in range(len(lst)):
arr = array(lst)
print('Product of all numbers is: ', prod(arr))
elif o == 'division':
d1 = int(input('Enter 1st number: '))
d2 = int(input('Enter 2nd number: '))
print('Quotient of numbers is: ', d1/d2)
For this you should install Python package Numpy!!
Hope it helps!!
Explanation:
import java.util.Scanner
class show
{
public static void main (String args[ ])
{
Scanner obj = new Scanner (System.in);
int a , b , c
System.out.println (" Enter your number ");
a = next.Int();
System.out.println ("Enter your number ");
b = next.Int();
c = a+b;
System.out.println ("Here is your added number"+c);
}
}
HOPE IT HELP YOU
PLEASE MARK AS BRAINLIEST