MOD = 3
def f(x):
return (x - 1) % MOD
for x in range(MOD):
print(f'f({x}) = {f(x)}')
const MOD = 3;
const f = x => (x + MOD - 1) % MOD;
for (let x = 0; x < MOD; x++)
console.log(`f(${x}) = ${f(x)}`);
int cur = 5;
int max = 10;
cur = ( cur-1 <= 0 )? max : cur-1;
int cur = 5;
int max = 10;
cur = max-cur/cur*(max+1)+cur;
#include <iostream>
int main() {
const size_t SIZE = 10;
int array[SIZE];
for (size_t i = 0; i < SIZE; ++i)
array[i] = i;
for (size_t i = 0; i < SIZE * 5; ++i)
std::cout << array[i % SIZE] << std::endl;
std::cout << std::endl;
for (int i = SIZE; i > -10; --i)
std::cout << array[i % SIZE] << std::endl;
return 0;
}