-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructure.c
52 lines (40 loc) · 1.1 KB
/
structure.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
struct student
{
char name[100];
char birth_place[100];
int age;
};
struct student std[10];
int i;
for ( i = 1; i <= 3; i++)
{
printf("Enter the name of the student: ");
scanf("%s", std[i].name);
printf("Enter the birthplace of the student: ");
scanf("%s", std[i].birth_place);
printf("Enter the age of the student: ");
scanf("%d", &std[i].age);
}
// for ( i = 1; i <= 3; i++)
// {
// printf(" the name of the student %d is : %s\n", i, std[i].name);
// printf(" the birthplace of the student %d is : %s\n", i, std[i].birth_place);
// printf(" the age of the student %d is : %d\n", i, std[i].age);
// }
// for ( i = 1; i < 3; i++)
// {
// if (std[i].birth_place==std[i+1].birth_place)
// {
// printf("%s %s are neighbours", std[i].name, std[i+1].name);
// }
// }
for ( i =1 ; i <= 3-1; i++)
{
/* code */
}
return 0;
}