Write C statements to do the following: a. declare an int variable called count
ID: 3837244 • Letter: W
Question
Write C statements to do the following: a. declare an int variable called count b. declare an int variable sum and initialize it to zero c. declare a char variable named up_down and initialize it to 'D' d. declare an unsigned char array named 'city' and initialize it with your home town e. declare a double variable named mpg and initialize it to 45.8 If an integer variable type holds n bits, what are the largest and smallest values it can hold in hex and decimal? The variable percent contained a zero after the following code executed. Fix the code so that percent contains the intended value of 0.85. int score = 85; float percent; percent = score/100; What is in i and k after the following code executes? int i = 0, j = 10, k = 0; i = j++;//what is in i? k = ++j; what is in k write C code to give a customer a 5% discount if their purchases were greater than DISC. Write C code using if statements to display 'Freshman, 'Sophomore', 'Junior' or 'Senior' based on what value is in variable classification. Display 'unknown' if classification does not contain 'f', 's', 'j' or 'r'. Allow upper or lower case in variable color. In other words either 'r' or 'R' will display 'Senior'. Write C code to do the same thing as the previous problem, but use a switch statement.Explanation / Answer
1.
a) int count;
b) int sum = 0;
c) char up_down = 'D';
d) unsigned char city[] = {'F','A','I', 'R', 'B', 'O', 'R','N'};
e) double mpg = 45.8
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.