Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.

Monday, December 5, 2011

Student record using Array of Structure in c

/*WAP of Student record using Array of Structure in c*/
#include<stdio.h>
#include<conio.h>
struct student
{
 int rollno, marks1,marks2,marks3,tot;
 char name[25],grade;
 float per;
};
void main()
{
 struct student s[5];     //Data type of '*s' is struct student
 int i;
 clrscr();
 printf("\t*Students Records*\n");
 //take input from user
 for (i=0; i<5; i++)
 {
 printf("\nEnter Student Roll Number: ");
 scanf("%d", &s[i].rollno);
 printf("\nEnter Student name: ");
 scanf("%s", s[i].name);
 printf("\nEnter Student 3 subject's marks: ");
 scanf("%d%d%d", &s[i].marks1,&s[i].marks2,&s[i].marks3);
 //calculation
 s[i].tot = s[i].marks1 + s[i].marks2 + s[i].marks3;
 s[i].per = s[i].tot/3;
 if(s[i].per>=75){
  s[i].grade = 'A';
 }
 else if(s[i].per<75 && s[i].per>=60){
  s[i].grade = 'B';
 }
 else if(s[i].per<60 && s[i].per>=50){
  s[i].grade = 'C';
 }
 else if(s[i].per<50 && s[i].per>=40){
  s[i].grade = 'D';
 }
 else if(s[i].per<40 && s[i].per>=33){
  s[i].grade = 'E';
 }
 else {
  s[i].grade = 'F';
 }
 }
 //Display result
 for (i=0; i<5; i++)
 {
 printf("\n==================================\n");
 printf("\nStudent's Roll no. - %d", s[i].rollno);
 printf("\nStudent's Name - %s", s[i].name);
 printf("\nStudent's Total Marks - %d", s[i].tot);
 printf("\nStudent's Percentage - %f", s[i].per);
 printf("\nStudent's Grade - %c", s[i].grade);
 }
 getch();
}

No comments:

Post a Comment

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share