Compare commits
2 commits
6b74662521
...
02e205ab3e
Author | SHA1 | Date | |
---|---|---|---|
|
02e205ab3e | ||
|
5c568568a6 |
2 changed files with 33 additions and 0 deletions
18
semaine-2/faire-tant-que/main.c
Normal file
18
semaine-2/faire-tant-que/main.c
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define MULTIPLICAND 9
|
||||||
|
#define TARGET 7101
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
|
||||||
|
int i = 0, result;
|
||||||
|
|
||||||
|
do {
|
||||||
|
result = MULTIPLICAND * i;
|
||||||
|
i++;
|
||||||
|
} while (result < TARGET);
|
||||||
|
|
||||||
|
printf("%i", i - 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
15
semaine-2/for-punition/main.c
Normal file
15
semaine-2/for-punition/main.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define MULTIPLICAND 7
|
||||||
|
#define TARGET 100
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 1; i <= TARGET; i++) {
|
||||||
|
printf("%03i x %i = %03i\n", i, MULTIPLICAND, i * MULTIPLICAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue