Saturday, July 15, 2017

URI problem 1541 solution in C | (Building Houses)

#include<stdio.h>
#include<math.h>
int main()
{
    float a,b,c,x,y;
    while(scanf("%f",&a)!='0'){
        if(a==0)break;
        scanf("%f %f", &b, &c);
        x = (((a*b)/c)*100);
        y=sqrt(x);
        printf("%d\n",(int)y);
    }
    return 0;
}

1 comment:

  1. #include
    int main()
    {
    int A,B,C,ans;
    while(1)
    {
    scanf("%d", &A);
    if(A==0)break;
    else
    {
    scanf("%d%d", &B,&C);
    if(C>20)
    {
    C=C-20;
    ans=(A+B)-(C/10);
    printf("%d\n", ans);
    }
    else
    {
    ans=A+B+(C/10);
    printf("%d\n", ans);
    }
    }
    }
    return 0;
    }

    ReplyDelete