Program to calculate sum,average and division of marks using else-if ladder in C Language

Introduction: In previous articles i explained the Program to calculate sum,average of marks and Else if ladder or multiple else if to check the day corresponding to number  and  How to find week days corresponding to number using switch case and Else if ladder or multiple else if to check the day corresponding to number  and Else if ladder or multiple else if to check the month of entered number and What is For loop in C language? Program to print counting up to given limit and What is goto statement in C language,its advantages and disadvantages with program example and Swap two numbers without using temporary variable and Find greatest of three numbers using nested if else statement

In this article i have written a program to calculate the total marks,average of marks and based on average, it calculates the division using else-if ladder or we can say multiple else-if.

Description: It will first prompt user to enter name,class,roll number and marks in each subject.Then it will calculate the total marks obtained,average of marks and division.

Implementation: Let's create a program to understand.

      char name[25];
      int roll,clas;
      float hindi,eng,math,sci,art,comp,total,avg;
      printf("Enter name of student:=");
      printf("Enter class of student:=");
      printf("Enter rollno of student:=");
      printf("Enter marks in hindi:=");
      printf("Enter marks in english:=");
      printf("Enter marks in math:=");
      printf("Enter marks in science:=");
      printf("Enter marks in art:=");
      printf("Enter marks in computers:=");
      printf("\n************Student's Marks Record*************\n");
      printf("Student's name=%s",name);
      printf("\nRoll No=%d",roll);
      printf("\nMarks in Hindi=%.0f",hindi);
      printf("\nMarks in English=%.0f",eng);
      printf("\nMarks in Math=%.0f",math);
      printf("\nMarks in Science=%.0f",sci);
      printf("\nMarks in Computer=%.0f",comp);
      printf("\nTotal Marks=%.0f",total);
      printf("\nAverage Marks=%.2f",avg);

 printf("\n Merit");
else if(avg>=60)
   printf("\n First Division");
  else if(avg>=50)
     printf("\n Second Division");
    else if(avg>=35)
printf("\n Pass");
         printf("\n Fail");
  • Run the program using Ctrl+F9
Enter name of student:=Karan
Enter class of student:=12
Enter rollno of student:=18
Enter marks in hindi:=77
Enter marks in english:=67
Enter marks in math:=80
Enter marks in science:=75
Enter marks in arts=68
Enter marks in computer:=88

****************Student's Marks Record****************
Student's name:=Karan
Roll No:=18
Marks in Hindi:=77
Marks in English:=67
Marks in Math:=80
Marks in Science:=75
Marks in Art:=68
Marks in Computer:=88
Total Marks:=455
Average Marks:=75.83
First Division

Now over to you:
"If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linked in and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates."
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..