Skip to content

Instantly share code, notes, and snippets.

@MaratB
Created September 22, 2013 22:01
Show Gist options
  • Save MaratB/6664296 to your computer and use it in GitHub Desktop.
Save MaratB/6664296 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <conio.h>
const int N = 6;
main()
{
int i, A[N], c;
for (i=0; i<N; i++)
{
printf("Введите A[%d]: ", i);
scanf("%d", &A[i]);
}
c = A[N-1]; // запомнить последний элемент
for (i =1; i<N-1; i++) // цикл с уменьшением i
A[N-i] = A[N-i-1];
A[0] = c; // первый элемент ставим отдельно
printf("\n Результат:\n");
for ( i = 0; i < N; i ++ )
printf("%d ", A[i]);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment