Friday, October 26, 2018

Uri 1043 Solution in C | Triangle

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

#include<stdio.h>
main()
{
   float a,b,c,p,area;
   scanf("%f%f%f",&a,&b,&c);
   if((a+b)>c&&(b+c)>a&&(c+a)>b)
   {
       p=a+b+c;
       printf("Perimetro = %.1f\n",p);
   }
   else
    {
    area=0.5*(a+b)*c;
   printf("Area = %.1f\n",area);
   }
   return 0;
}

 //Happy_Coding

No comments:

Post a Comment