Write a program to take input Dividend and Divisor and print its Quotient and Reminder in python

# Write a program to take input Dividend and Divisor and print its Quotient and Reminder

print("This is a simple calculator program which only divides.")
did = int(input("Pls enter the value of your divided in numbers:"))
dir = int(input("Pls enter the value of your divisor in numbers:"))
print("pls enter what you want to get from this calculator")
print("Warning: \nonly enter the option i.e. either a or b in lower case")
opt = input("a. Quotient \nb. Reminder \n")
if opt == "b" or opt == "b.":
    ans = did % dir
    print("Your answer \nRemainder is", ans)
elif opt == "a" or opt == "a.":
    sol = did/dir
    e = type(sol)
    if e == float:
      print("In which type of value do you want your answer")
      print("Warning: \nonly enter the option i.e. either a or b in lower case")
      o = input("a. Decimal \nb. Integer \n")
      if o == "b" or o == "b.":
          s = int(sol)
          print("Quotient \nyour answer is ", s)
      elif o == "a" or o == "a.":
          f = float(sol)
          print("Quotient \nYour answer is", f)
      else:
          print("The inputs are invalid")
          exit()
    elif e == int:
        g = int(sol)
        print("your answer \nQuotient is", g)
    else:
        print("The inputs are invalid")
        exit()
else:
    print("The inputs are invalid")
    exit()

4
1
Krish 100200 points

                                    # Write a program to take input Dividend and Divisor and print its Quotient and Reminder

print("This is a simple calculator program which only divides.")
did = int(input("Pls enter the value of your divided in numbers:"))
dir = int(input("Pls enter the value of your divisor in numbers:"))

a = did / dir
b = did // dir
c = did % dir

print("Float value of quotient:", a, "\nInteger value of quotient:", b, "\nRemainder value:", c)

4 (1 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source