Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Week 5 Problems
- Problem#1
- Write a simple program to execute the following expressions
- and print them to the screen with new line characters
- and line or number problems.
- 24 – 6 * 2
- 6.2 + 5.1 * 3.2
- 3 + = 3 * 4
- //If x = 3 and y = 6
- x++ + ++y
- --y
- y—
- 5 * 2 / 6 + 15 % 4
- Problem#2
- 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.
- Hint: To round, you must convert the floating-point number to an integer
- and then back to a floating-point number.
- Test the program with the following data:
- 123.456789 123.499999 123.500001
- Problem#3
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement