Untitled
unknown
plain_text
a year ago
656 B
9
Indexable
// Online C compiler to run C program online
#include <stdio.h>
#include<stdlib.h>
struct student{
int rollno;
char name[25];
int m1;
int m2;
int m3;
};
void main() {
struct student *ptr=(struct student*) malloc(1*(sizeof (struct student)));
scanf("%d",&(ptr)->rollno);
scanf("%s",(ptr)->name);
scanf("%d",&(ptr)->m1);
scanf("%d",&(ptr)->m2);
scanf("%d",&(ptr)->m3);
int totalmarks= (ptr->m1)+(ptr->m2)+(ptr->m3);
//print
printf("%d",(ptr)->rollno);
printf("\n%s",(ptr)->name);
printf("\n%d",(ptr)->m1);
printf("\n%d",(ptr)->m2);
printf("\n%d",(ptr)->m3);
printf("\n%d",totalmarks);
}Editor is loading...
Leave a Comment