CIS 1500 Lecture Notes - Lecture 4: Switch Statement, Scanf Format String, Negative Number

123 views9 pages

Document Summary

Given the following constants and variable declarations, val = step % size; Valid, val= 3: val = (450 - max)/ step; Give the c code to declare 3 variables, an int, a double and a char. Assign the value 28. 6 to the double and prompt the user to provide input for the other two variables. Print the value of all three variables with a single print statement. Use the following values as the basis for the decisions: 0-4 hours of sleep- sleep deprived!, more than 4 but less than 6- you need more sleep, 6 or more but less than 8- Give the c code for a loop that computes and displays a sum of numbers that the user enters. The loop should prompt the user for input until the user enters -335 and then exit and display the final sum. The loop allows the user to input characters (one of a, b or c).

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents