Skip to content
Snippets Groups Projects
Commit 5f2b035e authored by jerome.maison's avatar jerome.maison
Browse files

exo4

parent cbc38deb
Branches
No related tags found
No related merge requests found
...@@ -7,8 +7,9 @@ LDFLAGS:=-lm ...@@ -7,8 +7,9 @@ LDFLAGS:=-lm
ex4: ex4.c exo4: exo4.c
$(CC) $(CFLAGS) -c $@ $^ $(LDFLAGS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
clean: clean:
rm -f *.o ex4 rm -f *.o exo4
#include <stdio.h>
// table de multiplication
int table_multiplication(int, int);
int main() {
int nbr = 0;
printf("Entier:\n");
scanf("%d", &nbr);
printf("table:\n");
table_multiplication(nbr, 12);
}
int table_multiplication(int n, int k){
int r = n * k;
if(!k){
return 0;
}
printf("%d * %d = %d\n", n, k, r);
return table_multiplication(n, k - 1);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment