#include<stdio.h>
int main()
{
FILE *anik;
anik = fopen("bc.txt", "a");
char ch[50], pn[15];
int i, age, n;
if(anik == NULL)
{
printf("File doesn't exist\n");
}
else
{
printf("File is open\n");
printf("Enter any number : ");
scanf("%d", &n);
for(i=1;i<=n;i++)
{
getchar();
printf("Enter Age : ");
scanf("%d", &age);
printf("Enter Phone Number : ");
scanf("%s", &pn);
fflush(stdin);
printf("Enter Name : ");
gets(ch);
fprintf(anik, "\n%s\t%s%t%d\n", ch, pn, age);
}
fclose(anik);
}
return 0;
}
int main()
{
FILE *anik;
anik = fopen("bc.txt", "a");
char ch[50], pn[15];
int i, age, n;
if(anik == NULL)
{
printf("File doesn't exist\n");
}
else
{
printf("File is open\n");
printf("Enter any number : ");
scanf("%d", &n);
for(i=1;i<=n;i++)
{
getchar();
printf("Enter Age : ");
scanf("%d", &age);
printf("Enter Phone Number : ");
scanf("%s", &pn);
fflush(stdin);
printf("Enter Name : ");
gets(ch);
fprintf(anik, "\n%s\t%s%t%d\n", ch, pn, age);
}
fclose(anik);
}
return 0;
}
Comments
Post a Comment