Why the part of findbyname it retuns me "does not exist" and also show me informations
#include<stdio.h> #include<string.h> #include<conio.h> #include<stdbool.h> int n,m; struct student{ long int Id; char name[10]; float score[4]; float math,physics,programming; float sum; float avr; }st[]; void storeinfo(){ printf("Please enter student number : "); scanf("%d",&n); for(int i=0;i<n;i++){ printf("\nThe student %d id ",i+1); scanf("%ld",&st[i].Id); getchar(); printf("The student name "); gets(st[i].name); printf("physics: "); scanf("%f", &st[i].physics); printf("math: "); scanf("%f", &st[i].math); printf("programming: "); scanf("%f", &st[i].programming); printf("\n\n"); } } void avr(){ float sum; float avr; for(int i=0;i<n;i++){ sum=st[i].programming + st[i].math + st[i].physics; avr=sum/3; st[i].avr=avr; printf("Average mark of %s is %.2f\n",st[i].name,st[i].avr); } } void grade(){ for(int i=0;i<n;i++){ if(st[i].avr>100 || st[i].avr<0)printf("Impossible"); else if(st[i].avr>79 && st[i].avr<=100)printf("Excellent work\n"); else if(st[i].avr>59 && st[i].avr<=80)printf("Good work\n"); else if(st[i].avr>49 && st[i].avr<60)printf("Succeed\n"); else printf("you need to work hard\n"); } } void findbyname() { bool j; char name[10]; printf("The name you looking for : "); getchar(); gets(name); for(int i=0;i<n;i++){ if(strcmp(st[i].name,name)==0){ printf("these are %s Informations : \n",st[i].name); printf("Id : %d",st[i].Id); printf("\nMath: %.2f",st[i].math); printf("\nPhysics: %.2f",st[i].physics); printf("\nProgramming: %.2f",st[i].programming); j=1; } if(j!=1){printf("\nDoes not exist");} } } void findbyId() { int j; printf("The Id of the student you looking for : "); scanf("%d",&j); getchar();