The following program get Marks Card Details and shows Min and Max marks as the output.
#include<stdio.h>
#include<conio.h>
struct markscard {
int rollno;
int marks;
char name[35];
char addres[35];
} ;
void main()
{
struct markscard mcrd[10];
int i, maxm, mimm;
clrscr();
for(i=1;i<=10;i++)
{
printf("n%d Roll Number : ",i);
scanf("%d", &mcrd[i].rollno);
printf(" Name : ");
fflush(stdin);
gets(mcrd[i].name);
printf(" Address : ");
fflush(stdin);
gets(mcrd[i].addres);
printf(" Marks : ");
scanf("%d", &mcrd[i].marks);
}
clrscr();
printf("nThe Data you entered are :");
printf("n# Roll#tNametAddresstMarks");
maxm = 0;
mimm = mcrd[1].marks;
for(i=1;i<=10;i++)
{
printf("n%d %dt%-20st%-20st%d",i,mcrd[i].rollno,mcrd[i].name,mcrd[i].addres,mcrd[i].marks);
if (mcrd[i].marks >= maxm)
maxm = mcrd[i].marks;
if (mcrd[i].marks <= mimm)
mimm = mcrd[i].marks;
}
printf("nnHighest Marks : %d",maxm);
printf("nLowest Marks : %d",mimm);
getch();
}
0 comments:
Post a Comment