The marks obtained by the student in five different subjects are input through the keyboard. The student gets a division as per the following rules: -
Percentage above or equal to sixty is first division.
Percentage between fifty to fifty nine is second division.
Percentage between forty to forty nine is third division.
Percentage less than forty is fail.
#include <stdio.h>
#include <conio.h>
void main ( )
{
int m1, m2, m3, m4, m5, per;
clrscr ( );
printf ("\n\n\n\t Enter marks in first subject......:"); scanf ("%d",&m1);
printf ("\n\n\t Enter marks in second subject.....:"); scanf ("%d",&m2);
printf ("\n\n\t Enter marks in third subject......:"); scanf ("%d",&m3);
printf ("\n\n\t Enter marks in fourth subject.....:"); scanf ("%d",&m4);
printf ("\n\n\t Enter marks in fifth subject......:"); scanf ("%d",&m5);
per = (m1 + m2 + m3 + m4 + m5)/5;
if ( per >= 60)
{
printf ("\n\n\n\t\t FIRST DIVISION");
}
if ( ( per >= 50 ) && ( per < 60 ) )
{
printf ("\n\n\n\n\t\t SECOND DIVISION");
}
if ( ( per >= 40 ) && ( per < 50 ) )
{
printf ("\n\n\n\n\t\t THIRD DIVISION");
}
if ( per < 40 )
{
printf ("\n\n\n\n\t\t FAIL");
}
getch ( );
}
Click here to contact us
Percentage above or equal to sixty is first division.
Percentage between fifty to fifty nine is second division.
Percentage between forty to forty nine is third division.
Percentage less than forty is fail.
#include <stdio.h>
#include <conio.h>
void main ( )
{
int m1, m2, m3, m4, m5, per;
clrscr ( );
printf ("\n\n\n\t Enter marks in first subject......:"); scanf ("%d",&m1);
printf ("\n\n\t Enter marks in second subject.....:"); scanf ("%d",&m2);
printf ("\n\n\t Enter marks in third subject......:"); scanf ("%d",&m3);
printf ("\n\n\t Enter marks in fourth subject.....:"); scanf ("%d",&m4);
printf ("\n\n\t Enter marks in fifth subject......:"); scanf ("%d",&m5);
per = (m1 + m2 + m3 + m4 + m5)/5;
if ( per >= 60)
{
printf ("\n\n\n\t\t FIRST DIVISION");
}
if ( ( per >= 50 ) && ( per < 60 ) )
{
printf ("\n\n\n\n\t\t SECOND DIVISION");
}
if ( ( per >= 40 ) && ( per < 50 ) )
{
printf ("\n\n\n\n\t\t THIRD DIVISION");
}
if ( per < 40 )
{
printf ("\n\n\n\n\t\t FAIL");
}
getch ( );
}
Click here to contact us
No comments:
Post a Comment