-->

A program to get marks of any 5 subjects and to get total marks with percentage and division.

//Write a program to get marks of any 5 subjects and to get total marks with percentage and division.
#include<stdio.h>
#include<conio.h>
void main()
{
int marks_english,marks_math,marks_account,marks_cscience,marks_economics;
int total_marks;
float percentage;
printf("enter marks of all subjects \n");
printf("enter marks for english\n");
scanf("%d",&marks_english);
printf("enter marks for mathematics\n");
scanf("%d",&marks_math);
printf("enter marks for account\n");
scanf("%d",&marks_account);
printf("enter marks for cscience\n");
scanf("%d",&marks_cscience);
printf("enter marks for economics\n");
scanf("%d",&marks_economics);
if(marks_english>=40 && marks_math>=40 && marks_account>=40 && marks_cscience>=40 && marks_economics>=40)
  {
     printf("u have passed!!\n and \n");
      total_marks=marks_english+marks_math+marks_account+marks_cscience+marks_economics;
      percentage=(float) total_marks/5;
       if(percentage>=75)
           {
               printf("you have got %f percentage with distinction!!\n",percentage);
            }
      elseif(percentage>=60 && percentage<75 )
           {
               printf("you have got %f percentage with first division!!\n",percentage);
            }
      elseif(percentage>=55 && percentage<60 )
           {
               printf("you have got %f percentage with second division!!\n",percentage);
            }
       elseif(percentage>=40 && percentage<55 )
           {
               printf("you have got %f percentage with third division!!\n",percentage);
            }
   }
    
else
 {
printf("sorry, you have failed the exam.\n"); 
 printf("so there is no total and percentage with division for you.\n Try hard next time.\n");   
  } 
printf("thank you!!!!\n");
getch();
}

No comments:

Post a Comment