[ create a new paste ] login | about

Link: http://codepad.org/iWhmbUua    [ raw code | output | fork ]

lglasson - C, pasted on Nov 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>

int div(int a, int b){
int c;
c=a-b;
if(c<=0){
return 1;
}else{
return div(c, b) + 1;
}
}

int main(void){
printf("%d", div(12, 4));
return 0;
}


Output:
1
3


Create a new paste based on this one


Comments: