Student details enter program
#include<stdio.h>
#include<string.h>
struct student {
int age;
char name[50];
int r_no;
};
int main(){
int max ;
int i ,p;
printf("enter the total no .of students ");
scanf("%d",&max);
printf("\n");
struct student s[max];
for (i =0;i <max ;i++){
printf(" enter the name of the student ");
scanf("%s",s[i].name);
printf("\n");
printf("enter the student age");
scanf("%d",&s[i].age);
printf("\n");
printf("enter the roll number of the student");
scanf("%d",&s[i].r_no);
printf("\n");
}
for(p =0 ;p<max;p++){
printf("student name = %s ", s[p].name); printf("\n");
printf("age = %d ",s[p].age);
printf("\n");
printf("roll number = %d",s[p].r_no);
printf("\n");
}
}
Comments
Post a Comment