URI Online Judge Solution| 1012 Area

Problem:https://www.urionlinejudge.com.br/judge/en/problems/view/1012
Solution:
Don’t use float as in the problem it is said to use double
And hrere i have used End of file using while(scanf()==) loop

that means for 3 input i have given while(scanf(“%lf %lf %lf”,&a,&b,&c)==3)

#include<iostream>
#include<cstdio>
int main()
{
    double a,b,c,p,pi=3.14159,triangle,circle,trapezium,square,rectangle;
    while(scanf("%lf %lf %lf",&a,&b,&c)==3){
    triangle=a*c/2;
    circle=pi*c*c;
    p=a+b;
    trapezium=.5*p*c;
    square=(b*b);
    rectangle=a*b;
  printf("TRIANGULO: %.3lf\nCIRCULO: %.3lf\nTRAPEZIO: %.3lf\nQUADRADO: %.3lf\nRETANGULO: %.3lf\n",triangle,circle,trapezium,square,rectangle);
}
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.