Share this post on:

In this Java program we will take input from user and convert that output to print in ascending order. First it will take how many number user want to enter and then one by one the number will be taken from user and then print that in ascending order.

Example:

class TestDemo
{
public static void main(String[] args)
{
int t;
Scanner in=new Scanner(System.in);
System.out.println(“Enter Range”);
int n=in.nextInt();
int a[]=new int[n];
System.out.println(“Enter Element”);
for(int i=0;ia[j-1])
{
t=a[j-1];
a[j-1]=a[j];
a[j]=t;
}
}
for(int i=0;i<n;i++);
System.out.println(a[i]);
}
}

Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.

Leave a Comment

Your email address will not be published. Required fields are marked *