Rajout disque.c TP08

This commit is contained in:
HORVILLE 2021-10-11 16:21:15 +02:00
parent 693923722b
commit be7bee1906

24
APL1.1/TP08/disque.c Normal file
View File

@ -0,0 +1,24 @@
#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;
}