Friday, October 26, 2018

Uri 1036 Solution in C | Bhaskara's Formula

/*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,x,y;
    scanf("%f%f%f",&a,&b,&c);
    if(((b*b)-(4*a*c))<0||a==0)
    {
        printf("Impossivel calcular\n");
    }
    else
        {
            x=((-b)+pow(((b*b)-(4*a*c)),0.5))/(2*a);
            y=((-b)-pow(((b*b)-(4*a*c)),0.5))/(2*a);
            printf("R1 = %.5f\nR2 = %.5f\n",x,y);
        }

        return 0;


}

 //Happy_Coding

No comments:

Post a Comment