Skip to content

Instantly share code, notes, and snippets.

View andresR8's full-sized avatar
🤖

Andres Rengifo andresR8

🤖
  • www.kiwicampus.com
  • Bogota
View GitHub Profile
@andresR8
andresR8 / poker_chips.c
Created November 17, 2020 17:08
poker_chips
int getNumChips(int val){
int chips[6]={100,50,25,10,5,1};
int numChips=0;
size_t n = sizeof(chips)/sizeof(chips[0]);
for(int i=0; i<n; i++){
numChips += val/chips[i];
val = val % chips[i]; //only works if val is an integer
}