a simple file handling programe
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
FILE *even,*odd;
even=fopen("even.txt","w");
odd=fopen("odd.txt","w");
printf("enter the last term till you wanna see even and odd values");
scanf("%d",&a);
for(b=0;b<=a;b++)
if(b%2==0)
fprintf(even,"%d\n",b);
else
fprintf(odd,"%d\n",b);
printf("operation has successfully completed");
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
FILE *even,*odd;
even=fopen("even.txt","w");
odd=fopen("odd.txt","w");
printf("enter the last term till you wanna see even and odd values");
scanf("%d",&a);
for(b=0;b<=a;b++)
if(b%2==0)
fprintf(even,"%d\n",b);
else
fprintf(odd,"%d\n",b);
printf("operation has successfully completed");
getch();
}
No comments:
Post a Comment