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

Answer Posted / abc

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,root;
float x1,x2;
printf("enter the roots a,b,c");
scanf("%d %d %d",&a,&b,&c);
if(a=0&&b=0)
printf("no solution");
else
if(a=0)
{
root=-c/b;
printf("root=%d",root);
}
else
if[(b*b-4*a*c)>0]
{
x1=[-b+sqrt (b*b-4*a*c)]/(2*a);
x2=[-b-sqrt (b*b-4*a*c)]/(2*a);
printf("the roots are x1=%f,x2=%f",x1,x2);
}
else
printf("it has imaginary roots");
getch();
}

Is This Answer Correct ?    8 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why do some people write if(0 == x) instead of if(x == 0)?

642


Why is it usually a bad idea to use gets()? Suggest a workaround.

888


What are # preprocessor operator in c?

620


What is the difference between null pointer and wild pointer?

625


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

660






What does. int *x[](); means ?

627


What is meant by high-order and low-order bytes?

640


What is data type long in c?

614


1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

3973


How do we declare variables in c?

558


Why we write conio h in c?

549


what is use of malloc and calloc?

1372


What is meant by realloc()?

663


Write a code to remove duplicates in a string.

621


Why main is not a keyword in c?

637