Professional Documents
Culture Documents
Spring I - Introduction To Programming (C) - Final Test
Spring I - Introduction To Programming (C) - Final Test
-----------------------------
FINAL TEST (60 minutes)
INTRODUCTION TO PROGRAMMING
Exercise 1(6 points) – use functions
Write C program:
a. Input and output an array has n items (2)
b. Find maximum item, index and value (1)
c. Sort descending array and output (1)
d. Sum of all prime items (2)
e. Does array have all prime items (1)
f. Sort ascending negative items, descending positive items (1)
Ex:
a. Array: 7 5 -3 -1 8 -2
b. Maximum = 8, index = 4
c. Sort: 8 7 5 -1 -2 -3
d. Sum = 12
e. No
f.
Orignal: 7 5 -3 -1 8 -2
Sort: 8 7 -3 -2 5 -1