mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-11-26 13:44:18 +08:00
formatting source-code for 153fb7b8a5
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
int n, k;
|
||||
cout << "Enter size of array=\t";
|
||||
cin >> n;
|
||||
@@ -11,24 +10,18 @@ int main()
|
||||
cout << "Enter elements of array=\t";
|
||||
for (int i = 0; i < n; i++) cin >> a[i];
|
||||
int temp = 0;
|
||||
for (int i = 0; i < k; i++)
|
||||
{
|
||||
for (int i = 0; i < k; i++) {
|
||||
temp = a[n - 1];
|
||||
for (int j = n - 1; j >= 0; j--)
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
for (int j = n - 1; j >= 0; j--) {
|
||||
if (j == 0) {
|
||||
a[j] = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
a[j] = a[j - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
cout << "Your rotated array is=\t";
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int i = 0; i < n; i++) {
|
||||
cout << a[i] << " ";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user