import java.util.*;
class Histogram
{
public static void main(String arg[])
{
System.out.println("Enter any number");
Scanner a1= new Scanner(System.in);
int n= a1.nextInt();
int i=0,j,k,r;
int ar[]=new int[50];
while(n>0)
{
r=n%10;
ar[i]=r;
i++;
n=n/10;
}
for(j=ar[i];j<=0;j--)
{
k=ar[i];
for(int l=0;l
System.out.print("*");
}
System.out.println("");
i--;
}
}
}
Output:-
C:\Documents and Settings\Administrator>cd\
C:\>cd\java\bin
C:\java\bin>javac Histogram.java
C:\java\bin>java Histogram
Enter any number
342
***
****
**
I am here to discuss about Histogram as-A graphical representation which shows a visual impression of the distribution of data termed as Histogram . Histogram consists of tabular frequencies which are shown as adjacent rectangles, with an area equal to the frequency of the observations in the interval.
ReplyDeleteHow to do Ratios