Skip to content

Instantly share code, notes, and snippets.

@pcnoic
Created January 21, 2021 21:02
Show Gist options
  • Save pcnoic/59f48e4a63cc8b02f63f7b1aab502624 to your computer and use it in GitHub Desktop.
Save pcnoic/59f48e4a63cc8b02f63f7b1aab502624 to your computer and use it in GitHub Desktop.
for loops for finding all combinations
for (j = 1; j <= n; j++) {
for (i = 0; i < n-1; i++) {
temp = num[i];
num[i] = num[i+1];
num[i+1] = temp;
print(num, n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment