Last active
November 17, 2024 16:02
-
-
Save ghost355/0acea1be7a92d2ecbdb87470bd1dab4b to your computer and use it in GitHub Desktop.
Loop number цикличный перебор 1..n..1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define MAX_VALUE 5 | |
//x16 -> 1,2,3,4,5,4,2,1,2,3,4,5,4,3... | |
int main() { | |
for (int n = 0; n < 16; ++n) { // измените количество шагов, если нужно | |
int x = MAX_VALUE - abs(MAX_VALUE - (n % (2 * (MAX_VALUE - 1)))); | |
printf("%d\n", x); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment