APL/APL1.1/TP08/disque.c

25 lines
433 B
C
Raw Normal View History

2021-10-11 16:21:15 +02:00
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
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;
}