Results 1 to 4 of 4
Thread: histogram program in java
- 03-01-2011, 08:24 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
histogram program in java
histogram pattern program in java
public class histogram{
public static void main(String args[]){
int n = args.length;
int max = 0,j,i;
int a[]= new int[20];
for(i=0;i<n;i++)
{
a[i]=Integer.parseInt(args[i]);
}
for(i=0;i<n;i++)
{
if(a[i]>max)
{
max = a[i];
}
}
for(i=max;i>0;i--)
{
for(j=0;j<n;j++)
{
if(a[j]==i)
{
System.out.print("*");
a[j]-=1;
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}//end of main method
}//end of class
- 03-01-2011, 06:42 PM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
Do you have a question about this?
- 03-05-2011, 04:08 PM #3
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
no its just a program that i made by myself
and wanted to put it on my blog so that it could help anyone who needed this program
- 03-05-2011, 04:27 PM #4
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Similar Threads
-
JAI Histogram error
By deepsri in forum Advanced JavaReplies: 0Last Post: 01-07-2011, 10:06 AM -
histogram
By little_man in forum New To JavaReplies: 4Last Post: 11-13-2010, 01:38 AM -
Java Histogram program.. any adivce or hints wouls be great!!
By Chewart in forum New To JavaReplies: 8Last Post: 11-24-2009, 09:03 PM -
Regarding the display of histogram
By Mazharul in forum Java 2DReplies: 2Last Post: 08-27-2008, 03:09 AM -
How to create a Histogram
By Devilsfutbol17 in forum New To JavaReplies: 4Last Post: 06-04-2008, 09:22 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks