Answer Posted / valli
/***********
quadratic equationis ax^2+bx+c=0
************8/
#include<math.h>
main()
{
int a,b,c,d,r1,r2;
printf("enter the values of a,b,c");
scanf("%d%d%d",&a,&b,&c)'
d=(b*b)-(4*a*c);
if(d<0)
{
printf("the roots are imaginary");
d=sqrt(-d);
printf("\nroots are %d+i%d",-b/(2*a),d/(2*a));
printf("\n%d-i%d",-b/(2*a),d/(2*a));
}
else
{
d=sqrt(d);
r1=(-b+d)/(2*a);
r2=(-b-d)/(2*a);
printf("the roots of the equation are %d %d ",r1,r2);
}
}
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
Explain how can you tell whether a program was compiled using c versus c++?
difference between native and cross compilers
In a switch statement, what will happen if a break statement is omitted?
Differentiate between a for loop and a while loop? What are it uses?
What is optimization in c?
Why doesnt the call scanf work?
pierrot's divisor program using c or c++ code
Explain what are the __date__ and __time__ preprocessor commands?
What are structures and unions? State differencves between them.
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
What are multidimensional arrays?
how many key words availabel in c a) 28 b) 31 c) 32
What is the size of array float a(10)?