/*
* This Java program accepts 10 integers and stores them in an
* array. Then it prints the biggest and the smallest number
* entered.
*/
import java.util.*;
class largest_smallest
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 10 numbers");
int a[]=new int[10];
int i;
int small=0,larg=0;
for(i=0;i<10;i++)
{
a[i]=sc.nextInt();
if(i==0)
{
larg=a[0];
small=a[0];
}
if(a[i]<small)
{
small=a[i];
}
if(a[i]>larg)
{
larg=a[i];
}
}
System.out.println("Largest term = "+larg);
System.out.println("Smallest term = "+small);
}
}
//Author : Mayank Rajoria
* This Java program accepts 10 integers and stores them in an
* array. Then it prints the biggest and the smallest number
* entered.
*/
import java.util.*;
class largest_smallest
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 10 numbers");
int a[]=new int[10];
int i;
int small=0,larg=0;
for(i=0;i<10;i++)
{
a[i]=sc.nextInt();
if(i==0)
{
larg=a[0];
small=a[0];
}
if(a[i]<small)
{
small=a[i];
}
if(a[i]>larg)
{
larg=a[i];
}
}
System.out.println("Largest term = "+larg);
System.out.println("Smallest term = "+small);
}
}
//Author : Mayank Rajoria