Back to: Java Program’s
import java.util.Scanner; public class ascending_order { public static void main(String args[]) { int great1 = 0, great2 = 0, great3 = 0, great4 = 0; Scanner sc=new Scanner(System.in); System.out.println("Enter any 3 number from range 1 to 10"); int a=sc.nextInt(); int b=sc.nextInt(); int c=sc.nextInt(); if (a > b && b > c) { great1 = c; great2 = b; great3 = a; } else if (a > b && b < c) { great1 = b; great2 = c; great3 = a; } else if (b > a && a > c) { great1 = c; great2 = a; great3 = b; } else if (b > a && a < c) { great1 = a; great2 = c; great3 = b; } else if (c > a && a > b) { great1 = b; great2 = a; great3 = c; } else { great1=a ; great2 = b; great3 = c; } System.out.println("\f"); System.out.println("Assending order is"); System.out.println(great1); System.out.println(great2); System.out.println(great3); } }
Submitted By: Ms. Zarin Shroff
If this program was helpful to you, do leave a comment.
All Creadit goes to Ms. Zarin Shroff
P.N. : All the post on this website are for demonstration and education purpose only.
Student should perform all the practicals for there personal copies.
A very good program…