السابق التالي
0 / 21
الوحدة النمطية DEMO-32-106DEMO-C-32

Left Rotate Array

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

Write a C program to left rotate the elements of an array by 1 position. The first element should move to the last position, and all other elements should shift one position to the left. Input n and the integers, then display the rotated array.

Example

Input:

5 1 2 3 4 5

Output:

2 3 4 5 1

قيود

1 <= n <= 100

تنسيق الإدخال

n and array

تنسيق الإخراج

Left rotated array

حالات اختبار نموذجية

Submit runs every public testcase in this browser. Results and code never leave this device.

العينة رقم 1
عينة ظاهرة
5
1 2 3 4 5
2 3 4 5 1
1 moves to end.
العينة رقم 2
عينة ظاهرة
1
100
100
Single element, no change visually.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
إعدادات المحرر