2 of 3 Paper No: 1
The given file Q1.c already contains statements to input data for the three integer variables named a, b,and c. You should write statements so that print out the maximum number in three numbers.
Notes:
- Do not edit given statements in the main function.
- You can create new functions if you see it is necessary.
Sample input and output:
Input: a = 3, b = 7, c = 6
Output for marking:OUTPUT:
7
Question 2:
(3 marks)
The given file Q2.c already contains statements to input data for an integer variable named n. You should write statements to calculate the following expression value:
S(n)=12+22+32+...+n²
Notes:- Do not edit given statements in the main function.
- You can create new functions if you see it is necessary.
Sample input and output:
Input: n=3 After processing: S(3) = (1+2+3)=1+4+9=14
Output for marking:
OUTPUT:14
Question 3:
(2 marks)
The given file Q3.c already contains statements to input data for the integer 1-D array and an integer variable named x. You should write statements to replace the elements equal to x in the array with the value 0.
+ 80%
Zoom
Close