Skip to content

Commit

Permalink
1541 C
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPLopes committed Dec 30, 2019
1 parent c9fc74e commit 5f0f44e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions C/1541.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <stdio.h>
#include <math.h>

typedef struct
{
int a, b;
} Square;

int area(Square *square)
{
return square->a * square->b;
}
int maxBuilds(Square *s, int areaHouse)
{
int builds = area(s) *100;
return pow(builds /areaHouse, .5);
}
int main(int argc, char const *argv[])
{
Square square = {0, 0};
int a, b, c = -1;

while (scanf("%d", &a) && a != 0)
{
scanf("%d %d", &b, &c);
square.a = a;
square.b = b;

printf("%d\n", maxBuilds(&square, c));
}

return 0;
}

0 comments on commit 5f0f44e

Please sign in to comment.