Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { double A,B,C,D,E,F,G,H; scanf ("%lf %lf %lf", &A, &B, &C); D=.5*A*C; E=3.14159*C*C; F=.5*(A+B)*C; G=B*B; H=A*B; printf ("TRIANGULO: %.3lf\n", D); printf ("CIRCULO: %.3lf\n", E); printf ("TRAPEZIO: %.3lf\n", F); printf ("QUADRADO: %.3lf\n", G); printf ("RETANGULO: %.3lf\n", H); return 0; }
#include
ReplyDeleteint main()
{
double A, B, C, pi=3.14159,RTA, CA, TRAPI, SA, RA;
scanf("%lf%lf%lf",&A,&B,&C);
RTA = (1/2.0)*A*C;
CA= pi*C*C;
TRAPI= ((A+B)/2.0)*C;
SA= B*B;
RA= A*B;
printf("TRIANGULO: %.3lf\n",RTA);
printf("CIRCULO: %.3lf\n",CA);
printf("TRAPIZIO: %.3lf\n",TRAPI);
printf("QUADRADO: %.3lf\n",SA);
printf("RETANGULO: %.3lf\n",RA);
return 0;
}
/* what is different between your code and my code. please give the solution of problem and explanation*/