hi there

my prog prompts for the number of students in a class and then for a mark for each of them.then it is supose to display a histogram of how many student have the same mark, as a bar chart.am having problems on the displaying parts. i think is probably the way i declared the variables but am not sure anymore.please any idea

the output now is this:Code:#include <stdio.h> void main(){ int num; int i; int students[20]; int marks [5]; printf("How many students are in the class? :"); scanf("%d", &num); for(i=0;i<=num-1;i++){ printf("Enter the marks for the student %d :" ,i+1); scanf("%d",&students[i]); } for(i=0;i<=4;i++){ marks[i]=0; } for(i=0;i<num-1;i++){ if (students[i]==0){ marks[0]++;} else{ if (students[i]==1) marks[1]++; else{ if (students[i]==2) marks[2]++; else {if (students[i]==3) marks[3]++; else{ if (students[i]==4) marks[4]++; } } } } } for(i=0;i<=4;i++){ printf("%d\t %d\n", i, asterix(marks[i])); } scanf("%d",&students[i]); } asterix(char n) { int i; char c=' '; char ch='*'; if(n==0){ printf("%c", c ); } else{ for(i=0;i<=n;i++) { printf("%c", ch); } } return; }

How many students are in the class? :5

Enter the marks for the student 1 :1

Enter the marks for the student 2 :1

Enter the marks for the student 3 :1

Enter the marks for the student 4 :1

Enter the marks for the student 5 :1

0 1

*****1 1

2 1

3 1

4 1

It is supposed to be like this:

How many students are in the class? :5

Enter the marks for the student 1 :1

Enter the marks for the student 2 :1

Enter the marks for the student 3 :1

Enter the marks for the student 4 :1

Enter the marks for the student 5 :1

0

1 *****

2

3

4