Advertisement
hcfell

Week 5 Problems

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