Categorize students according to their marks


Levels of difficulty: / perform operation:

C Program

#include<stdio.h>
	#include<conio.h>
	void main() {
		int m,a,b,c,d,e,f,g,h,i;
		char ch;
		a=b=c=d=e=f=g=h=i=0;
		read:
			clrscr();
		printf("enter the Marks in range 0 - 100 \n");
		scanf("%d", &m);
		/* use simple if statement */
		if(m>80) a++;
		if(m>60) b++;
		if(m>40) c++;
		if(m<=40) d++;
		/* use else if ladder ship */
		if(m>80) e++; else if(m>60) f++; else if(m>40) g++; else
				    h++;
printf("Any more Student <<y/n>> ?");
ch = getche();
if(ch =='y') goto read;
printf("\n");
printf("Who have more then 80 Marks = %d\n",a);
printf("Who have more then 60 Marks = %d\n",b);
printf("Who have more then 40 Marks = %d\n",c);
printf("Who have less or 40  Marks = %d\n",d);
printf("Who have obtain in range 81 -100 = %d\n",e);
printf("Who have obtain in range 60 - 80 = %d\n",f);
printf("Who have obtain in range 40 - 60 = %d\n",g);
printf("Who have obtain in range 0 -  40 = %d\n",h);
getch();
}