Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
789 B
3
Indexable
Never
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		System.out.println("tedad adad ra vared konid?");
		Scanner sc= new Scanner(System.in);
		int n =sc.nextInt();
		f(n);
		
	}
	public static void f(int n){
	    Scanner sc= new Scanner(System.in);
	    int [] a= new int [n];
	   	System.out.println("adad hara vared konid: ") ;
	   for(int i=0;i<=n;i++)
	   {
	       a[i]=sc.nextInt();
	   }
	   for(int i=0;i<n;i++)
	   {
	       for(int j=i+1;j<n;j++)
	       {
    	       if(a[i]>a[j])
    	        {
    	            int t=a[i];
    	            a[i]=a[j];
    	            a[j]=t;
    	        }
	       }
	   }
	   System.out.println("moratab shode:") ;
	   for (int i=0; i<n; i++)   
        {  
            System.out.println(a[i]);  
	    }
}
}