Q3B - } } printf("The no of students belonging...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> void main() { int a[50],g[11]; int i,x; clrscr(); printf("Enter the marks of the class"); for(i=0;i<50;i++) { scanf("%d",&a[i]); } for(i=0;i<50;i++) { x=a[i]/10; switch(x) { case 0:{g[0]++; break;} case 1:{g[1]++; break;} case 2:{g[2]++; break;} case 3:{g[3]++; break;} case 4:{g[4]++; break;} case 5:{g[5]++; break;} case 6:{g[6]++; break;} case 7:{g[7]++; break;} case 8:{g[8]++; break;} case 9:{g[9]++; break;} case 10:{if(x==100) g[10]++; break;} default:{printf("Input Error")}
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } } printf(&amp;quot;The no of students belonging to each group is&amp;quot;); printf(&amp;quot; ) 0-9 %d\n&amp;quot;,g[0]); printf(&amp;quot; ) 10-19 %d\n&amp;quot;,g[1]); printf(&amp;quot; ) 20-29 %d\n&amp;quot;,g[2]); printf(&amp;quot; ) 30-39 %d\n&amp;quot;,g[3]); printf(&amp;quot; ) 40-49 %d\n&amp;quot;,g[4]); printf(&amp;quot; ) 50-59 %d\n&amp;quot;,g[5]); printf(&amp;quot; ) 60-69 %d\n&amp;quot;,g[6]); printf(&amp;quot; ) 70-79 %d\n&amp;quot;,g[7]); printf(&amp;quot; ) 80-89 %d\n&amp;quot;,g[8]); printf(&amp;quot; ) 90-99 %d\n&amp;quot;,g[9]); printf(&amp;quot; ) 100-9 %d\n&amp;quot;,g[10]); getch(); }...
View Full Document

This note was uploaded on 10/25/2010 for the course CMPN SEM1 taught by Professor Thakur during the Fall '06 term at University of Mumbai.

Ask a homework question - tutors are online