Closed jeethub26230 closed 4 years ago
Good luck to all students
I am Jhansi and my solution is a1=int(input("enter first number")) a2=int(input("enter second number")) a3=int(input(" choose 1.add 2.sub 3.mul 4.divide")) if(a3==1): print(a1+a2) if(a3==2): print(a1-a2) if(a3==3): print(a1*a2) if(a3==4): print(a1/a2) if(a3!=1 and a3!=2 and a3!=3 and a3!=4): print("choose the correct option")
a=int(input('enter 1st number')) b=int(input('enter 2nd number')) c=input("choose any operation +,-,, / : ") if c=='+' print('a+b') elif c=='-' print('a-b') elif c=='' print('a*b') elif c=='/' print('a/b') else print('invalid choice')
#This is Dinesh Behera
#Python program for Simple Calculator
def add(n1, n2):
return n1 + n2
def subtract(n1, n2):
return n1 - n2
def multiply(n1, n2):
return n1 * n2
def divide(n1, n2):
return n1 / n2
num1 = int(input("Enter First number: "))
num2 = int(input("Enter Second number: "))
print("Please select your choice -\n" "1. Add\n" "2. Subtract\n" "3. Multiply\n" "4. Divide\n")
ch = int(input("Enter your Choice :"))
if ch == 1:
print(num1, "+", num2, "=",
add(num1, num2))
elif ch == 2:
print(num1, "-", num2, "=",
subtract(num1, num2))
elif ch == 3:
print(num1, "*", num2, "=",
multiply(number_1, number_2))
elif ch == 4:
print(num1, "/", num2, "=",
divide(num1, num2))
else:
print("Invalid input")
Hello, I am Debasis and here is my code. print('1.ADD') print('2.SUB') print('3.MUL') print('4.DIV') a= input('Enter choice(1/2/3/4):') b=int(input('Enter 1st no:')) c=int(input('Enter 2nd no:')) if a=='1': print('Sum=',b+c)
elif a=='2': print('Sub=',b-c)
elif a=='3': print('Mul=',b*c)
elif a=='4': print('Div=',b/c) else: print("Invalid Choice")
a=int(input("enter the 1st number")) b=int(input("enter the 2nd number")) choise=input("select the choise(1=add,2=sub,3=mul,4=div):") if choise=='1': print(a+b) elif choise=='2': print(a-b) elif choise=='3': print(a*b) elif choise=='4': print(a/b) else: print("invalid choise")
b=int(input("Enter 1st number: ")) c=int(input("Enter 2nd number: ")) a=int(input("For Multiplication:1 Division:2 Addition:3 Subtraction:4\n")) if (a==1): print("Multiplication of "+str(b)+" and "+str(c)+" is "+str(b*c)) elif(a==2): if(c==0): print("2nd number cannot be zero") else: print("Division of "+str(b)+" and "+str(c)+" is "+str(b/c)) elif(a==3): print("Addition of "+str(b)+" and "+str(c)+" is "+str(b+c)) elif(a==4): print("Subtraction of "+str(b)+" and "+str(c)+" is "+str(b-c)) else: print("Invalid Input")
a = int(input('Enter the first number : ')) b = int(input('Enter the second number : '))
op = input('Enter the operation to be done:\n + for addition\n - for subtraction\n * for multiplication\n / for division\n Your Input : ')
if (op == '+'): print('Sum : ' + str(a + b)) elif (op == '-'): print('Difference : ' + str(a - b)) elif (op == ''): print('Product : ' + str(a b)) elif (op == '/'): if (b == 0): print('Division with zero is not possible') else: print('Quotient : ' + str(a/b)) else: print('Please give a valid operation')
Hello I am Ankita my code is a=int (input("enter first number")) b=int (input("enter second number")) c=int (input ("choose one operation addition,subtraction,multiplication,division")) If c=='addition': Print('a+b') elif c=='subtraction': Print('a-b') elif c=='multiplication': Print('a*b') elif c=='division' Print('a/b') else Printf ("invalid choise")
a=int(input(enter 1st number: )) b=int(input(enter 2nd number: )) print('select the operation') c=input(enter any choice 1,2,3,4 : ) result=0 if c=='1': result=a+b elif c=='2': result=a-b elif c=='3': result=a*b elif c=='4': result=a/b else: print('input choice is not recognised')
print('a' c 'b', result)
a = int(input("Enter the number1 : ")) b = int(input("Enter the number2 : "))
choice = input('Enter the operation to be done:\n + for addition\n - for subtraction\n * for multiplication\n / for division\n Your Input : ')
if (choice == '+'): print('Sum : ' + str(a + b)) elif (choice == '-'): print('Difference : ' + str(a - b)) elif (choice == ''): print('Product : ' + str(a b)) elif (choice == '/'): if (b == 0): print('Division with zero is not possible') else: print('Quotient : ' + str(a/b)) else: print('choice is invalid')
num1=int(input("enter num1\n")) num2=int(input("enter num2\n")) op=input("enter the operation to be performed") if(op=='add'): result=num1+num2; print("the result is",result) elif(op=='sub'): result=num1-num2; print("the result is",result) elif(op=='mul'): result=num1*num2; print("result is",result) elif(op=='div'): result=num1/num2; print("the result is",result) elif(op=='modulo'): result=num1%num2; print("the result is",result) else: print("wrong choice")
I am Charu num1=int(input ("enter the first number")) num2=int(input ("enter the second number")) Print("select the operation") ch=input ("enter any of these char for operation +,-,/,) result=0 if ch == '+': result = num1+num2 elif ch == '-': result = num1- num2 elif ch =='': result = num1*num2 elif ch =='/': result = num 1/num2 else: Print ("input character is not recognised")
Hi, This is VIJIT
a=int(input("Enter 1st no")) b=int(input("Enter 2nd no")) ch=input("Choose the operand 1) + 2) - 3) 4) /") if ch=='1': print(a+b) elif ch=='2': print(a-b) elif ch=='3': print(ab) elif ch=='4': print(a/b) else: print("invalid operand")
a=int(input("Enter a number: ") b= int(input("Enter another number: ") c= input("Enter calculation symbols for operations ") if c=='+': result = a+b elif c=='-': result = a-b elif c=='': result = a b elif c=='/': result =a/b print(result) else: print("invalid")
num1 = int(input("Enter First Number: ")) num2 = int(input("Enter Second Number: "))
print("Enter which operation would you like to perform?") a = input("Enter any of these char for specific operation +,-,*,/: ")
result = 0 if a == '+': result = num1 + num2 elif a == '-': result = num1 - num2 elif a == '': result = num1 num2 elif a == '/': result = num1 / num2 else: print("Input character is not recognized!")
print(num1, a , num2, ":", result)
print("Select an operation.") print("+") print("-") print("*") print("/")
choice = input("Enter operator to use:") A = float(input("Enter first number: ")) B = float(input("Enter second number: ")) if choice == '+': print(A,"+",B,"=", A+B) elif choice == '-': print(A,"-",B,"=", A-B) elif choice == '': print(A,"",B,"=", A*B) elif choice == '/': print(A,"/",B,"=", A/B) else: print("Invalid input")
Sarthak Nayak
a = int(input('enter a number')) b = int(input('enter 2 no.')) c =int(input('enter no. ')) if (c == 1): print(a + b) elif (c == 2): print(a - b) elif (c == 3): print(a * b) elif (c == 4): print(a/b) else: print("bye!!!")
This issue is task given to the COSS LEAP2.0 Students only.
Kindly Provide your answers below in comments.