Jump to content

Schema Logica Pentru Ecuatia De Gradul 2 In C/c++


Recommended Posts

  • Moderators
Posted

Realizaţi schema logica pentru rezolvarea ecuaţiei de gradul 2.

#include <stdio.h>
#include <math.h>
int main()
{
    int a,b,c,d;
    float x1,x2;
    scanf("%d %d %d",&a,&b,&c);
    d=b*b-4*a*c;
    if (d==0)
        printf("Exista o singura solutie reala: %d",(-b)/(2*a));
    else
        if (d>0)
        {
            x1=(-b+sqrt(d))/(2*a);
            x2=(-b-sqrt(d))/(2*a);
            printf("Solutiile in R ale ecuatiei sunt %.2f si %.2f",x1,x2);
        }
        else
            printf("Ecuatia nu are solutii reale");
    return 0;
}

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.