Turn Desktop View Off
by Dinesh Thakur

 In this program user asks to find out the Student grade and marks. User define strut concept in this program and the array type variable for storing the liable value. Here user asking to enter the required fields like roll no, name and marks of student. After declaring all the user using control statement as nested if-else for marking out the status about passing or fail criteria here user insist a condition if(s[k].m1>=35 && s[k].m2>=35 && s[k].m3>=35) then pass else fail. After finding out this one user find out the total obtaining marks of students.

User here again uses nested if-else condition like “if(s[k].avg>=60)” then it will be pass and grade “A” or other condition will be vary pass and grade “b” or “c” etc. after finding out all the marks and grades user declare printing method for printing out the marks on screen as a result.
Problem Statement:
This is C program that asks user to find out the marks and the grade.

  1. Declare the variables.
  2. Using control statement.
  3. Using total finding method.
  4. Display result on the screen.

Here is C source code for finding out the marks. The output of this program shown below.

#include<stdio.h>

#include<conio.h>
int k=0;
struct stud
{
       int rn;
       char name[30];
       int m1,m2,m3,total;
       float avg;
       char grade,result;
}s[30];
       void main()
{
       int no,roll=101,i;
       clrscr();
       printf("Enter No of Students : ");
       scanf("%d",&no);
       for(i=0;i<no;i++)
       {
            clrscr();
            s[k].rn=roll;
            printf("\nEnter the Student Roll Number : %d ",s[k].rn);
            printf("\nEnter the Student Name :");
            fflush(stdin);
            gets(s[k].name);
            printf("\nEnter the Three Marks : ");
            scanf("%d",&s[k].m1);
            scanf("%d",&s[k].m2);
            scanf("%d",&s[k].m3);
            if(s[k].m1>=35 && s[k].m2>=35 && s[k].m3>=35)
              {
                 s[k].result='P';
              }
            else
             {
                 s[k].result = 'F';
             }
                 s[k].total = s[k].m1+s[k].m2+s[k].m3;
                 printf("The Total is : %d",s[k].total);
                 s[k].avg=s[k].total/3;
                 if(s[k].avg>=60)
                  {
                      if(s[k].result == 'P')
                         {
                              s[k].grade = 'A';
                         }
                        else
                        {
                               s[k].grade = 'N';
                        }
                  }
                 else if(s[k].avg>=50)
                         {
                              if(s[k].result == 'P')
                                {
                                       s[k].grade = 'B';
                                 }
                               else
                                {
                                       s[k].grade = 'N';
                                }
                         }
                 else if(s[k].avg>=35)
                        {
                             if(s[k].result == 'P')
                               {
                                     s[k].grade = 'C';
                               }
                             else
                              {
                                     s[k].grade = 'N';
                              }
                        }
                                      getch();
                                      k++;
                                      roll++;
           }
                       printf("\n*******************************************************");
                       printf("\n                      STUDENT MARKLIST ");
                       printf("\n*******************************************************");
                       printf("\nROLL \tNAME   MARK1 MARK2 MARK3 TOTAL RESULT Average GRADE");
                       for(i=0;i<no;i++)
                           {
                              printf("\n%d\t%s   %d    %d    %d    %d    %c    %0.1f     %c",s[i].rn,s[i].name,s[i].m1,s[i].m2,s[i].m3,s[i].total,s[i].result,s[i].avg,s[i].grade);
                           }
                              getch();

Print Student Marklist