I found the formula...but i guess urs is better

hear

Code:

int y = (total)/100;
++a[y-2];

If total is 499 it removes the 2nd last integers and now y is 4 then y-2 gives us 2 which means ++a[2]; is incremented ..how was that ..

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SIZE 9
int main()
{
int a[SIZE]= {0};
int total1,total, gross, sal=200, y;
printf ( "Enter you gross sales in a week:$ ");
scanf ("%d", &gross );
while ( gross != -1 ){
total1 = (gross * 9) /100;
total = total1 +sal;
y = floor ( total ) /100;
++a[y-2];
printf ("Enter your gross sales in a week:$ ");
scanf ( "%d", &gross );
}
printf ("According to the price\n");
printf (" 200-299: %d\n"
" 300-399: %d\n"
" 400-499: %d\n"
" 500-599: %d\n"
" 600-699: %d\n"
" 700-799: %d\n"
" 800-899: %d\n"
" 900-999: %d\n"
" 1000 and above: %d", a[0], a[1], a[2], a[3], a[4], a[5], a[6],a[7], a[8]);
system("PAUSE");
return 0;
}