Lab 06
Lab 06
Lab 06
Task:
Source Code:
#include <stdio.h>
struct Student {
char name[50];
int roll;
float marks[6];
float totalMarks;
};
printf("Name: ");
scanf("%d", &students[i].roll);
scanf("%f", &students[i].marks[j]);
printf("\n");
float sum = 0;
sum += students[i].marks[j];
students[i].totalMarks = sum;
int main() {
int numStudents = 5;
inputStudentData(students, numStudents);
calculateTotalMarks(students, numStudents);
displayStudentData(students, numStudents);
return 0;
}
Input & Output:
Problem 2: Write a C program to manage the accounts of a bank's customers.
Define a structure Account with the following fields:
Task:
Source Code:
#include <stdio.h>
#include <string.h>
struct Account {
int accountNumber;
char accountHolderName[100];
float balance;
};
scanf("%s", accounts[i].accountHolderName);
scanf("%f", &accounts[i].balance);
printf("\n");
if (accounts[i].accountNumber == accountNumber) {
accounts[i].balance += amount;
return;
if (accounts[i].accountNumber == accountNumber) {
if (accounts[i].balance >= amount) {
accounts[i].balance -= amount;
} else {
return;
} else {
printf("-------------------------\n");
int main() {
int n = 5;
inputAccountData(accounts, n);
calculateInterest(accounts, n);
displayAccountDetails(accounts, n);
return 0;