code wars responsable drinker
#include <stdio.h>
const char *responsible_drinking(int cups) {
if (cups < 4) {
return "No, I am not drunk";
} else {
return "Yes, I am drunk";
}
}
This C code defines a function named responsible_drinking
that takes an integer argument cups
. If the value of cups
is less than 4, the function returns the string "No, I am not drunk"
. Otherwise, if the value of cups
is 4 or greater, the function returns the string "Yes, I am drunk"
. The function uses an if
statement to make this decision based on the value of the cups
variable.