Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created July 17, 2016 13:47
Show Gist options
  • Save Jack-Saleem/95013f5f1de64e2cc2ae39cda61e6eea to your computer and use it in GitHub Desktop.
Save Jack-Saleem/95013f5f1de64e2cc2ae39cda61e6eea to your computer and use it in GitHub Desktop.
codeforces 221A LittleElephantandFunction program in java
import java.util.Scanner;
public class LittleElephantandFunction
{
public static void main(String[] args)
{
Scanner z=new Scanner(System.in);
int n=z.nextInt();
int[] a=new int[n];
while(n>=1){
a[n-1]=n;
n--;
}
int temp=0;
for(int x=a.length-1;x>0;x--)
{
temp=a[x];
a[x]=a[x-1];
a[x-1]=temp;
}
for(int aa:a)
System.out.print(aa+" ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment