#include <stdio.h>
int docs[100] = {};
int f = 0;
int r = 0;
void enque(int x){
docs[r++] = x;
}
int deque(){
return docs[f++];
}
int empty(){
return r==f;
}
int size(){
return r-f;
}
int main() {
int n = 7;
int k = 3;
int count = 0;
for (int i = 1;i <= n;i++){
enque(i);
}
while (!empty()) {
count ++;
if (count == k) {
printf("%d ", deque());
count = 0;
}else{
enque(deque());
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: