Back to Home & C
//Program to enter student name,roll no,and marks and store it in a file called stud
#include<stdio.h>
#include<conio.h>
void main()
{
int rno;
char name[20];
float mark;
FILE*fp;
fp=fopen("stud","w");
clrscr();
printf("Enter student roll number");
scanf("%d",&rno);
printf("Enter name");
scanf("%s",name);
printf("Enter mark");
scanf("%f",&mark);
printf("Writing to file...\n");
fprint(fp,"%d%s%f",rno,name,mark);
getch();
}
---------------------------------------------------
Output:
=========================================================================
Back to Home & C
//Program to enter student name,roll no,and marks and store it in a file called stud
#include<stdio.h>
#include<conio.h>
void main()
{
int rno;
char name[20];
float mark;
FILE*fp;
fp=fopen("stud","w");
clrscr();
printf("Enter student roll number");
scanf("%d",&rno);
printf("Enter name");
scanf("%s",name);
printf("Enter mark");
scanf("%f",&mark);
printf("Writing to file...\n");
fprint(fp,"%d%s%f",rno,name,mark);
getch();
}
---------------------------------------------------
Output:
=========================================================================
Back to Home & C
1 comment:
thank you sir.
Post a Comment