Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Categorize students according to their marks

#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 
");
		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("
");
printf("Who have more then 80 Marks = %d
",a);
printf("Who have more then 60 Marks = %d
",b);
printf("Who have more then 40 Marks = %d
",c);
printf("Who have less or 40  Marks = %d
",d);
printf("Who have obtain in range 81 -100 = %d
",e);
printf("Who have obtain in range 60 - 80 = %d
",f);
printf("Who have obtain in range 40 - 60 = %d
",g);
printf("Who have obtain in range 0 -  40 = %d
",h);
getch();
}
Source by scanftree.com #
 
PREVIOUS NEXT
Tagged: #Categorize #students #marks
ADD COMMENT
Topic
Name
1+5 =