/*display records where age 20-25*/
#include<stdio.h>
main()
{
char name[25];
int age;
FILE *fp;
fp=fopen("c.txt","r"); /*c.txt must be present in desktop with name and age */
printf("Name\tAge\n");
while(fscanf(fp,"%s%d",&name,&age)!=EOF)
{
if(age<=25&&age>=20)
printf("%s\t%d\n",name,age);
}
fclose(fp);
}
Note: create txt file with name and different age, and the above program will display only age between 20 and 25