a. Write a C program to read marks of N subjects and find Total, Average and Percentage marks. Your program should implement the following functions:
- getMarks: This function will collect all the marks that are to be used in calculations.
- calculateAverage: This function calculates the average or mean of the marks.
b. Write a program in C to draw a circle on the screen using the graphics.h header file. In this program, draw a circle on the screen with the center at the mid of the screen and a radius of 80 pixels. You may find the detailed descriptions of graphics functions below useful:
Function Description
- initgraph: It initializes the graphics system by loading the passed graphics driver and changing the system into graphics mode.
- getmaxx: It returns the maximum X coordinate in the current graphics mode and driver.
- getmaxy: It returns the maximum Y coordinate in the current graphics mode and driver.
- suttextxy: It displays a string at a particular point (x, y) on the screen.
- circle: It draws a circle with a radius f and center at (x, y).
- closegraph: It unloads the graphics drivers and sets the screen back to text mode.
For Example:
- 100 in Decimal is equivalent to 1100100 in the Binary number system.
Algorithm to convert Decimal to Binary number:
- Divide the input decimal number by 2 and store the remainder.
- Store the quotient back to the input number variable.
- Repeat this process until the quotient becomes zero.
- The equivalent binary number will be the remainders in the above process in reverse order.
For Example:
Suppose the input decimal number is 13.
Step 1: 13/2, Remainder = 1, Quotient = 6
Step 2: 6/2, Remainder = 0, Quotient = 3
Step 3: 3/2, Remainder = 1, Quotient = 1
Step 4: 1/2, Remainder = 1, Quotient = 0
Now, the Binary equivalent of 13 is the remainders in reverse order: 1101
d. Write a C program to convert a decimal number to a binary number [10]
e. Consider multiplication as repeated addition and then write a function multiply(x, x) that will implement recursion to do this multiplication [5]