Program that reads three numbers and prints them in ascending order.
Answers
Answered by
7
Explanation:
In Java
import java.util.*;
int a ,b,c
Scanner s=new Scanner(System.in)
System.out.println("Enter a number")
a=s.nextInt();
System.out.println("Enter another number")
b=s.nextInt()
System.out.println("Enter third no.")
c=s.nextInt
if(a>b>c){
System.out.println("first number is greatest")}
if(b>a>c){
System.out.println("second number is greatest")}
if(c>a>b){
System.out.println("third number is greatest")}
}
}
Hope it helps u
Pls mark it brainliest
Answered by
35
x=int(input("Enter first number:"))
y=int(input("Enter second number:"))
min=mid=max=None
if x<y and x<z:
if y<z:
min,mid,max=x,y,z
else:
min,mid,max=x,z,y
elif y<x and y<z:
if x<z:
min,mid,max=y,x,z
else:
min,mid,max=y,z,x
else:
if x<y:
else:
min,mid,max=z,y,x
print("Numbers in ascending order:",min,mid,max)
Similar questions