Math, asked by pardhuvadupu, 5 months ago

Write a program to input 10 different numbers. Display the greatest and the smallest number
among them.
pls ans fast pls

Answers

Answered by kamalrajatjoshi94
4

Answer:

import java.io.*;

class GreatestSmallest

{

public static void main(String args[])throws IOException

{

InputStreamReader read=new InputStreamReader(System.in);

BufferedReader in=new BufferedReader(read);

int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,ab, bc;

System.out.println("Enter the numbers");

a=Integer.parseInt(in.readLine());

b=Integer.parseInt(in.readLine());

c=Integer.parseInt(in.readLine());

d=Integer.parseInt(in.readLine());

e=Integer.parseInt(in.readLine());

f=Integer.parseInt(in.readLine());

g=Integer.parseInt(in.readLine());

h=Integer.parseInt(in.readLine());

i=Integer.parseInt(in.readLine());

j=Integer.parseInt(in.readLine());

k=Math.max(a,b);

l=Math.max(c,k);

m=Math.max(d,l);

n=Math.max(e,m);

o=Math.max(f,n);

p=Math.max(g,o);

q=Math.max(h,p);

r=Math.max(i,q);

s=Math.max(j,r);

t=Math.min(a,b);

u=Math.min(c,t);

v=Math.min(d,u);

w=Math.min(e,v);

x=Math.min(f,w);

y=Math.min(g,x);

z=Math.min(h,y);

ab=Math.min(i,z);

bc=Math.min(j,ab);

System.out.println("Greatest number="+s);

System.out.println("Smallest number="+bc);

}

}

I solved this in computer it said class compiled no syntax errors.

Similar questions