PropellerAds

How to write a program in C to find the root of a Quadratic Equation

No comments :

How to write a program in C to find the root of a Quadratic Equation

In this example the value of a,b,c are given we have to just put formula
You can do this problem via accepting values of a,b,c from user and then show the final output
CODE-

#include<stdio.h>

int main()

{

int a=5,b=10,c=15,root,x,y;

   root=(b*b-4*a*c);

    x=(-b+root)/(2*a);

    y=(-b-root)/(2*a);

    printf("\n quadratic equation is %d and %d",x,y);

    

}


Output





In case where user have to enter the value of the a,b,c variables then write the following code before the formula


And  the output will come according the value entered by user

No comments :

Post a Comment