A C program to print name,age ,total mark After aceepting it using structure
#include<stdio.h>
#include<conio.h>
struct student
{
char name[20];
int age;
int mark1;
int mark2;
int total;
float precent;
};
void main()
{
struct student stud;
clrscr();
printf("\nEnter the name of Student\n");
scanf("%s",stud.name);
printf("\nEnter the Age of student\n");
scanf("%d",&stud.age);
printf("\nEnter the Mark 1 out of 100\n");
scanf("%d",&stud.mark1);
printf("\nEnter the Mark 2 out of 100\n");
scanf("%d",&stud.mark2);
stud.total=stud.mark1+stud.mark2;
stud.precent=stud.total*100/200;
clrscr();
printf("\nName ::%s\n\nAge ::%d\n",stud.name,stud.age);
printf("\nTotal Mark ::%d\n\nPrcentage ::%f",stud.total,stud.precent);
getch();
}
|