Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
524 B
1
Indexable
Never
#include <stdio.h>
#include <stdlib.h>

void main()
{
   FILE *fptr;
char name[30];
int roll;
char address[50];
float marks;

fptr=fopen("C:\\student.txt","w");

if(fptr==NULL) {

    printf("Unable to create or open the file.\n");
    exit(0);
}

 printf("Enter name of the student: \t");
 gets(name);

 printf("Enter roll of %s: \t",name);
 scanf("%d",&roll);

  printf("Enter address of %s: \t",name);
  gets(address);

   printf("Enter marks of %s: \t",name);
   scanf("%f",&marks);

}

Leave a Comment