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
why do some people write if(0 == x) instead of if(x == 0)?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What are # preprocessor operator in c?
What is the difference between null pointer and wild pointer?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What does. int *x[](); means ?
What is meant by high-order and low-order bytes?
What is data type long in c?
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
How do we declare variables in c?
Why we write conio h in c?
what is use of malloc and calloc?
What is meant by realloc()?
Write a code to remove duplicates in a string.
Why main is not a keyword in c?