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
Where static variables are stored in memory in c?
This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory
What is 02d in c?
What is a far pointer in c?
What is sizeof int in c?
What does the && operator do in a program code?
Between macros and functions,which is better to use and why?
What is array of structure in c programming?
Explain what is the purpose of "extern" keyword in a function declaration?
Explain what does it mean when a pointer is used in an if statement?
How many loops are there in c?
Why is %d used in c?
Why doesnt that code work?
How is = symbol different from == symbol in c programming?
Can you please compare array with pointer?