To write a C Program to find area of rectangle using pointer.
- Start the program.
- Read two numbers.
- Calculate the area of rectangle using the formula area=(x)(*y)
- Display the result.
- Stop the program.
Thus the program to find area of rectangle using pointer has been executed successfully
To write a C Program to print 'WELCOME' using malloc() and free().
- Start the program.
- Read a string variable.
- Allocate memory using malloc().
- Display the string.
- Remove the allocated memory using free().
- Stop the program.
Thus the program to print 'WELCOME' using malloc() and free() has been executed successfully
.
To write a C Program to store the student information and display it using structure.
- Start the program.
- Create a student structure with name, roll number and marks as members.
- Using structure variable read the structure members and print them.
- Stop the program.
Thus the program to store the student information and display it using structure has been executed successfully
To write a C Program to read and store the data of 3 employees and calculate their Gross Salary using the concept of structure.
- Start the program.
- Create an employee structure with name, id and salary details as members.
- Using structure variable read the structure members.
- Calculate the gross salary and print the details.
- Stop the program.
Thus the C program to read and store the data of 3 employees and calculate their Gross Salary using the concept of structure
Create a C program to calculate the total and average of student using structure.
Step 1: Start the program. Step 2: Define a struct student with: • name: a character array (size 10) for the student's name (not used in the logic). • rollno: an integer for the student's roll number (also unused). • subject[5]: an array to store marks of 5 subjects. • total: an integer to store total marks. Step 3: Declare an array s[2] of type struct student for 2 students. Also declare variables n, i, and j for input and iteration. Step 4: Input Loop (i = 0 to 1): • Read an integer n (but it's not used later — possibly intended for roll number or placeholder). • Loop j = 0 to 4: o Read 5 subject marks into s[i].subject[j]. Step 5: Total Marks Calculation Loop (i = 0 to 1): • Initialize s[i].total to 0. • Loop j = 0 to 4: o Add each subject mark to s[i].total. Step 6: Override Total (Hardcoded): • Set s[0].total = 374; • Set s[1].total = 383; This step overwrites the computed totals. It seems like testing or hardcoded totals — unnecessary if you’re already calculating them. Step 7: Output Loop (i = 0 to 1): • Print s[i].total for each student. Step 8: End the program.
Thus the C program to calculate the total and average of student using structure has been executed successfully.