#include <stdio.h>#include <stdlib.h> int f(int min, int max, int n){ return max - abs(n % ((max - min) * 2) - (max - min));} int main(){ int i; for(i = 0; i < 50; i++) printf("%d,", f(3, 7, i)); return 0;}
Standard input is empty
3,4,5,6,7,6,5,4,3,4,5,6,7,6,5,4,3,4,5,6,7,6,5,4,3,4,5,6,7,6,5,4,3,4,5,6,7,6,5,4,3,4,5,6,7,6,5,4,3,4,
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!