Greatest And Smallest Number

6 comments - Post a comment

/************ Implementaion On Numbers In Java*************/

class Numbers
{
public static void main(String args[])
{
int i,great_no,small_no;
int no[] = {5,78,1,6,74,9,6,4,6,7};
System.out.println("Elements in the Array : ");
for(i=0;i< 10;i++)
System.out.print(no[i]+"\t");
great_no = no[0]; small_no = no[0];
for(i=1;i< 10;i++)
{
if(great_no< no[i])
great_no = no[i];
else if(small_no>no[i])
small_no = no[i];
}
System.out.print("\nGreatest Number : "+great_no);
System.out.print("\nSmallest Number : "+small_no);
}
}

/************** OUTPUT ****************

Elements in the Array :
5 78 1 6 74 9 6 4 6 7

Greatest Number : 78
Smallest Number : 1 */

 
This Post has 6 Comments Add your own!
Anonymous - July 23, 2009 at 9:09 AM

very good

Anonymous - July 23, 2009 at 9:09 AM

can u make flowchart as well?thanks

Anonymous - October 3, 2009 at 4:29 AM

Thanks, this helped me figure out my problem.

Anonymous - November 17, 2010 at 8:22 AM

thanks it help me with my java activity..

Anonymous - December 8, 2010 at 8:49 PM

i want to find area of rectangle,circle,square,triangle and circumference of circle using switch case in java

Anonymous - September 26, 2012 at 1:17 PM

Can u add the remaining elements??

Post a Comment