program to find the roots of a quardratic equation
Answer / 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 |
Why c is called a mid level programming language?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? a.infinite b.5 c.4 d.6
What are the properties of union in c?
What is an anonymous union and where to apply that ?
What are the commands should be given before weiting C Program i.e, Cd.. like
4 Answers IBM, Infonet, Satyam, Tech Mahindra,
What are register variables in c?
write a programme that inputs a number by user and gives its multiplication table.
Which header file is essential for using strcmp function?
What is scope of variable in c?
how to write hello word without using semicolon at the end?
What is 'makefile' in C langauage? How it be useful? How to write a makefile to a particular program?