Professional Documents
Culture Documents
PROCEDURAL PROGRAMMING IN C
ASSIGNMENT BRIEF
October 2022
Hand In date:
3. Write a C program to input n numbers in an array, calculate the sum of all even
numbers and all odd numbers in the array and print the larger sum. (5 Marks)
Example:
If the array contains the following elements:
2, 3, 3, 5, 4, 8, 7, 11, 2
The sum of all even elements is 2+4+8+2=16
Sum of all odd elements is 3+3+5+7+11=29
Therefore, the output should be 29.
4. Describe the difference between the literal values 7, "7", and ’7’. (5 Marks)
5. Determine the size,minimum and maximum value following data types. Please
specify if your machine is 32 bit or 64 bits in the answer. (5 Marks)
char
unsigned char
short
int
unsigned int
unsigned long
float
Hint: Use sizeof() operator,limits.h and float.h header files
b. Write the function struct node∗ addback(struct node∗ head,int data) that adds an
element to the end of the list. The function should return the new head node to
the list. (10 Marks)
c. Write the function struct node∗ find(struct node∗ head,int data) that returns a
pointer to the element in the list having the given data. The function should
return NULL if the item does not exist. (10 Marks)
Students are required to demonstrate the workings of the Task 1 and provide answers
to the questions asked.
Assignments and/or Reports Instructions
Each assignment must have a front cover which must include the student's full name, NID
number, title of the assignment and module name.
Students are required to submit an electronic copy (PDF) of the assignment to Moodle before
23:59 hrs on the due date.
Plagiarism in any form is prohibited. Plagiarised materials will not be accepted and no marks
will be awarded for the work.
All assignments files must be saved in the following file name order: abbreviated unit title
and student number - for example: BIS Mariyam Ali
It is the responsibility of the student to ensure that the assignments are submitted by the
deadline set by the lecturer.
If an extension is required, it should be communicated with the lecturer and approved by the
Course Coordinator. Appropriate evidence or reason should be provided to justify the cause
for the extension. A student can request for an extension 3 (three) days before the assignment
deadline. The request for extension of assignment deadline should be made in writing
(letter/email) and addressed to the Course Coordinator.