Answer:: The Details Are Entered It Is Stored in An Array of Structures
Answer:: The Details Are Entered It Is Stored in An Array of Structures
structures with four fields (Roll number, Name, Marks, and Grade). Each field is of
an appropriate data type. Print the marks of the student given student name as
input
Answer:
INPUT
Name
Roll No
Marks
Grade
Step1: Create a structure student to maintain a details like Name, Roll No, Marks of the
student
Step5: If student Name not find in the record print Detailed Not found
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct student{
char name[20];
int rollNo;
int marks[3];
float percentage;
};
int main(){
int n,i,j;
int tempTotal=0,flag=0,foundIndex;
char tempName[14];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",&stuArray[i].name);
scanf("%d",&stuArray[i].rollNo);
tempTotal=0;
for(j=0;j<3;j++)
tempTotal+=stuArray[i].marks[j];
stuArray[i].percentage=tempTotal/3;
printf("\n Enter the student Name to be Searched and print the mark of the student: ");
scanf("%s",&tempName);
for(i=0;i<n;i++){
if(strcmp(tempName,stuArray[i].name)==0)
foundIndex=i;
flag=1;
break;
if(flag==0)
else
for(i=0;i<3;i++)
return 0;
OUTPUT:
1.Name :Priyanka
Mark 1 :87
Mark 2 :98
Mark 3 : 89
Enter the student Name to be searched and print the mark of the student: Priyanka
Mark 1 is 87
Mark 2 is 98
Mark 3 is 89