Exercises Fundamnetal C Programming
Exercises Fundamnetal C Programming
Exercises Fundamnetal C Programming
a) Write a prototype for the function add and function display. b) Declare and initialize values for a sequence number of 1, 4, 7, 10,
b) Write a function definition for the function add that returns the …., 25 to a one-dimensional array number.
sum of two values to the calling function.
c) Declare a two-dimensional integer array matrix with 3 rows and
4 columns.
12. A supermarket stores item name, number of items sold and prices for
10. A declaration statement in C for an array of scienceScore is given each item in its transaction system.
below.
int scienceScore [ ] = {15,18,12,15,17,9,12,16}; a) Write a definition statement struct retail in C to store the
information below.
Write a code segment in C that includes each of the following:
Calculate the average value from the array above.
Count the number of array elements that has the value less b) Write an array declaration statement in C for 20 items of type
than average. struct retail as defined in (a).
Determine whether there is an array element that has the
same value as the average value. If found, print “Yes, the c)
same value exists!”, otherwise print “No, the same value Write a code segment in C to read and display the item name,
does not exist!”. number of items sold and price for each item sold. An example of
the display is shown below.