Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. /*
  2. Problem#1
  3.  
  4. Write a simple program to execute the following expressions and print them to the screen with new line characters and line or number problems. NOTE: RE-INITIALIZE X AND Y AFTER EVERY TIME POST FIX OR PRE FIX IS USED.
  5. If x = 3 and y = 6
  6.  
  7. 24 – 6 * 2
  8.  
  9. 6.2 + 5.1 * 3.2
  10.  
  11. 3 += 3 * 4
  12.  
  13. //If x = 3 and y = 6
  14.  
  15. x++ + ++y
  16.  
  17. --y
  18.  
  19. y--
  20.  
  21. 5 * 2 / 6 + 15 % 4
  22.  
  23. Problem#2
  24.  
  25. Write a program that reads a positive floating-point number from the user and calls a function that rounds that number to two decimal places. For example, 127.565031 rounds to 127.570000. The rounded number will be printed to six decimal places.
  26.  
  27.  
  28.  
  29. Hint: To round, you must convert the floating-point number to an integer and then back to a floating-point number.
  30.  
  31.  
  32.  
  33. Test the program with the following data:
  34.  
  35.  
  36.  
  37. 123.456789 123.499999 123.500001
  38.  
  39.  
  40.  
  41. Problem#3
  42.  
  43. Write a program that converts degrees into radians. The measure of an angle is a radian and a radian equals 57.295779 degrees. Provide user prompts and include the following test data: 90o is 1.57080 radians
  44. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement