write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0

Answer Posted / adde.c

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2,y,z;
printf("Please Enter 3 inputs of a,b,c in This
format:a<space>b<space>c=");
scanf("%f%f%f",&a,&b,&c);
y=(b*b-4*a*c);
if(a==0&&b==0)
{
printf("There is No Solution!!!!");
}
else if(a==0&&b!=0)
{
x1=(-1)*c/b;
printf("x1=%f",x1);
}
else
{
if(y>=0)
{
z=sqrt(y);
x1=((-1)*b+z)/(2*a);
x2=((-1)*b-z)/(2*a);
printf("Value of x1=%f & x2=%f",x1,x2);
}
else
{
printf("Your Equiation Showing an imaginery
value.....!!!!!!");
}
}
getch();
}

Is This Answer Correct ?    12 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should the volatile modifier be used?

689


Why do we need volatile in c?

750


How are strings stored in c?

601


What does %p mean c?

634


What are Macros? What are its advantages and disadvantages?

653






How can I write a function that takes a format string and a variable number of arguments?

611


What is void main () in c?

743


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1321


explain what is a newline escape sequence?

694


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

613


What is variable initialization and why is it important?

623


What are near, far and huge pointers?

650


Write a program with dynamically allocation of variable.

613


Explain what is a program flowchart and explain how does it help in writing a program?

653


What is integer constants?

628