Java 개발자 수업 강의노트/Java 일일 과제
배열을 shit->
캬캬백곰
2012. 4. 24. 16:07
728x90
# 배열에 저장된 데이터를 오른쪽으로 한 칸씩 이동하여 출력 (0번째는 1)
public static void main(String[] args) {
// 정렬된 숫자를 오른쪽으로 한칸씩 이동(0번째는 1)
int[] arr={3,7,5,3,4,6,9};
int a=1;
int temp;
for(int i=0; i<arr.length; i++){
temp=arr[i];
arr[i]=a;
a=temp;
}
for(int i=0; i<arr.length; i++){
System.out.print(arr[i]+"\t");
}
728x90
반응형