write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / lazy guyz
#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 ? | 1 Yes | 7 No |
Post New Answer View All Answers
what are bit fields? What is the use of bit fields in a structure declaration?
Explain high-order bytes.
What is the difference between abs() and fabs() functions?
What are the types of functions in c?
Can you assign a different address to an array tag?
Can you please explain the difference between malloc() and calloc() function?
What is your stream meaning?
Why flag is used in c?
How many levels deep can include files be nested?
using for loop sum 2 number of any 4 digit number in c language
What are global variables and how do you declare them?
What are the types of variables in c?
What is 1d array in c?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
How do you define structure?