#include<stdio.h>
struct anik
{
char name[100];
float cgpa;
char id[15];
};
int main()
{
int n,i,maxcg,k;
printf("Enter any number : ");
scanf("%d", &n);
struct anik A[n];
for(i=0; i<n; i++)
{
getchar();
printf("Name : ");
gets(A[i].name);
printf("CGPA : ");
scanf("%f", &A[i].cgpa);
getchar();
printf("ID : ");
gets(A[i].id);
}
maxcg = A[0].cgpa;
k = 0;
for(i=0; i<n; i++)
{
if(maxcg<A[i].cgpa)
{
maxcg = A[i].cgpa;
k = i;
}
}
printf("\nHeights CGPA Student : \n");
printf("Name : %s\n", A[k].name);
printf("CGPA : %0.2f\n", A[k].cgpa);
printf("ID : %s\n", A[k].id);
return 0;
}
struct anik
{
char name[100];
float cgpa;
char id[15];
};
int main()
{
int n,i,maxcg,k;
printf("Enter any number : ");
scanf("%d", &n);
struct anik A[n];
for(i=0; i<n; i++)
{
getchar();
printf("Name : ");
gets(A[i].name);
printf("CGPA : ");
scanf("%f", &A[i].cgpa);
getchar();
printf("ID : ");
gets(A[i].id);
}
maxcg = A[0].cgpa;
k = 0;
for(i=0; i<n; i++)
{
if(maxcg<A[i].cgpa)
{
maxcg = A[i].cgpa;
k = i;
}
}
printf("\nHeights CGPA Student : \n");
printf("Name : %s\n", A[k].name);
printf("CGPA : %0.2f\n", A[k].cgpa);
printf("ID : %s\n", A[k].id);
return 0;
}
Comments
Post a Comment