From be7bee19062e05e3fb47cce61638bae35cbc898e Mon Sep 17 00:00:00 2001 From: HORVILLE Ewen Date: Mon, 11 Oct 2021 16:21:15 +0200 Subject: [PATCH] Rajout disque.c TP08 --- APL1.1/TP08/disque.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 APL1.1/TP08/disque.c diff --git a/APL1.1/TP08/disque.c b/APL1.1/TP08/disque.c new file mode 100644 index 0000000..d6ee13a --- /dev/null +++ b/APL1.1/TP08/disque.c @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char * argv[]) { + + float rayon; + + printf("Veuillez indiquer le rayon de votre disque : "); + scanf("%f", &rayon); + + for (int x = 0; x <= rayon*2; x++) { + for (int y = 0; y <= rayon*2; y++) { + double dist = sqrt(pow(x-rayon, 2.0) + pow(y-rayon, 2)); + + if (dist <= rayon) printf(" *"); + else printf(" "); + } + printf("\n"); + } + + return EXIT_SUCCESS; +} +