[SOLVED] Introduction to Programming Languages CECS130 

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-3.zip (94.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Lab #3.      Programming assignment (100 pts):

Write a computer program in C which will simulate a calculator.  Your calculator needs to support the five basic operations (addition, subtraction, multiplication, division and modulus) plus primality testing (natural number is prime if it has no non-trivial divisors). Example of the output follows: 

 

Calculator Menu:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus (integers only)
  • Test if prime (integers only)
  • Exit

 

Please choose an operation: 2

Enter the first number: 18

Enter the second number: 20

18 – 20 = -2

 

Calculator Menu:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus (integers only)
  • Test if prime (integers only)
  • Exit

Please choose an operation: 6

Enter the number to be tested: 22

Not prime: 2 x 11 = 22

 

Calculator Menu:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus (integers only)
  • Test if prime (integers only)
  • Exit

Please choose an operation: 7 Good Bye!

 

You program MUST be bug-free, well commented (Including author information, program description, lab section, date, etc.)

  • Assignment-3.zip