import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a number");
int arr[]=new int[10];
int rep[]=new int[10];
int t=0;
for(int i=0;i<5;i++)
{
arr[i]=sc.nextInt();
}
int c=0;
for(int j=0;j<1000;j++)
{
for(int k=0;k<5;k++)
{
if(j==arr[k])
{
rep[t]=j;
t++;
}
}
}
System.out.println("sorted array");
for(int i=0;i<5;i++)
System.out.println(rep[i]+" ");
}
}
public class Main
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter a number");
int arr[]=new int[10];
int rep[]=new int[10];
int t=0;
for(int i=0;i<5;i++)
{
arr[i]=sc.nextInt();
}
int c=0;
for(int j=0;j<1000;j++)
{
for(int k=0;k<5;k++)
{
if(j==arr[k])
{
rep[t]=j;
t++;
}
}
}
System.out.println("sorted array");
for(int i=0;i<5;i++)
System.out.println(rep[i]+" ");
}
}
No comments:
Post a Comment
any problem in any program comment:-