APS106H1 Midterm: APS106H1_20151_621429313022mid_2015_A_answers

40 views7 pages

Document Summary

Aps106 midterm february 10, 2015 (with answers) Instructors: c. beck, m. bussmann, j. esmaeelpanah, l. shu, v. sinnathurai circle the name of the instructor whose lectures you attend. Important: marks will be awarded for correctness of your algorithm, c syntax, adherence to recommended c coding practice, code efficiency, and the clarity of your program. Answer: 10 (b 1. 5 marks) the following bit of code asks a user for three integers in increasing or decreasing order. For example, 1 2 5 and 4 4 9 and 9 6 5 and 3 1 1 are all valid input. Write an appropriate conditional ?? int i, j, k; printf("enter three integer values in increasing or decreasing order:"); scanf("%d %d %d", &i, &j, &k); if ( ??? ) else. Answer: (i <= j && j <= k) || (i >= j && j >= k) printf("values not in order"); printf("values in order");

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

Related Documents