// p03_14.cpp: Frequency diagram.
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{  int a[25], i, j, max = 0;
   cout << 
      "Enter 25 positive integers, not greater than 40:\n";
   for (j=0; j<25; ++j)
   {  if (!(cin >> a[j]) || a[j] <= 0 || a[j] > 40)
      {  cout << "Incorrect input.\n";
         return 1;
      }
      if (a[j] > max) max = a[j]; 
   }
   cout << endl;
   for (i=max; i>0; --i)
   {  for (j=0; j<25; ++j)
         cout << (a[j] >= i ? "  I" : "   ");
      cout << endl;
   }
   for (j=0; j<25; ++j) 
      cout << setw(3) << j;
   cout << endl;
   return 0;
}
