Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Details
- #include<stdio.h>
- struct details{
- char name[30];
- int roll;
- char address[50];
- char date_of_birth[20];
- };
- int main(){
- int num;
- printf("Enter number of student: ");
- scanf("%d", &num);
- getchar();
- struct details ob[num];
- for(int i = 0; i < num; i++){
- printf("\n\nEnter Details of student %d\n\n", i+1);
- printf("Enter name: ");
- gets(ob[i].name);
- printf("Enter your roll: ");
- scanf("%d", &ob[i].roll);
- getchar();
- printf("Enter you address: ");
- gets(ob[i].address);
- printf("Enter your date of birth: ");
- gets(ob[i].date_of_birth);
- }
- for(int i = 0; i < num; i++){
- printf("\n\nDetails of student %d\n", i+1);
- printf("\nName : %s", ob[i].name);
- printf("\nRoll number: %d", ob[i].roll);
- printf("\nAddress: %s", ob[i].address);
- printf("\nDate of Birth: %s", ob[i].date_of_birth);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement