algorithms/implementation/save-the-prisoner.c
int saveThePrisoner(int n, int m, int s) {

/*
int n: the number of prisoners
int m: the number of sweets
int s: the chair number to begin passing out sweets from
Returns

int: the chair number of the prisoner to warn
n m s
5 2 1  => 1. 2 3 4 5
5 2 2  =>
7 19 2 =>
3 7 3  =>
*/
    return (s-1 + m-1) % n + 1;
}
// Complete the saveThePrisoner function below.
Complete the saveThePrisoner function below.
Complete the saveThePrisoner function below .
int saveThePrisoner(int n, int m, int s) {
    return (s-1 + m-1) % n + 1;
}
int saveThePrisoner ( int n , int m , int s ) { return ( s - 1 + m - 1 ) % n + 1 ; }
Complete the saveThePrisoner function below.
Complete the saveThePrisoner function below .
/*
int n: the number of prisoners
int m: the number of sweets
int s: the chair number to begin passing out sweets from
Returns

int: the chair number of the prisoner to warn
n m s
5 2 1  => 1. 2 3 4 5
5 2 2  =>
7 19 2 =>
3 7 3  =>
*/