Write a C program to solve the quadratic equation ax^2+bx+c=0.
A quadratic equation has two roots which are given by the following two formulas:
root1= -b+sqrt(b^2-4*a*c)/2*a
root1= -b-sqrt(b^2-4*a*c)/2*a
The program request the user for input a,b,c and the output will be root1 and root2.
#include<stdio.h>
#include<math.h>
int main(){
float a,b,c;
float d,root1,root2;
printf("Enter quadratic equation in the format ax^2+bx+c: ");
scanf("%fx^2%fx%f",&a,&b,&c);
d = b * b - 4 * a * c;
if(d < 0){
printf("Roots are complex number.
");
return 0;
}
root1 = ( -b + sqrt(d)) / (2* a);
root2 = ( -b - sqrt(d)) / (2* a);
printf("Roots of quadratic equation are: %.3f , %.3f",root1,root2);
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Is it VB.NET support operator overloading?
100 computers ip how to calculate
is it possible to get u.s visa with 55% in b-tech and 15 backlogs
tell me the e book for data structure (basic)
what are differences between composition and inheritance in c
Q.1 Write a C language program to perform CCITT group 3 compression. If possible, scan some images and use your program to compress the images. What kind of compression did you achieve? Q2. How does a magneto-optical technology differ from WORM technology? Explain the differences in the manner in which you would use them for a multimedia system. Q3. What network considerations would you contemplate in designing an enterprise-wide multimedia system which supports fully distributed integrated messaging, sharing of corporate multimedia information databases, and custom business process applications? Q4. Explain the difference between the various types of multimedia object servers. How would you set up hierarchical storage for a large distributed organization? Q5. Explain the role of each type of server required in a multimedia system and the type of storage media that should be used for it. Q6. How do your decisions affect the design? Would different decisions on network technologies and object server technologies result in a different solution?
what is trx?
what is the effect of low frequency(say 48Hz) on TUrbo- Generator set when running for a prolonged period?
Please help to write testcase for ECG machine
Hi all, Pls find the bellow mentioned interview questions related to hp-unix. 1. Job Scheduling; mainly crontab, at, batch command 2. Backup stetegy; incremental, full system back up; diff between tar & ufsdump 3. diff between hard link & softlink 4. How to list only the directories inside a directory (Ans. ls -l|grep "^d") 5. RAID levels; pros & cons of diffrent levels; what is RAID 1+0 6. How to recover a system whose root password has lost? 7. What is a daemon? 8. How to put a job in background & bring it to foreground? 9. What is default permissions for others in a file? 10. Questions on shell initialization scripts? 11. Questions on restricted shell 12. What is diff betwn grep & find? 13. What is egrep? 14. Questions on shell programming 15. What is a pipe? 16. Questions on Solaris patch management like pkgadd etc Thnaks & Regards Biswanath Das Email ID:biswanath_das84@yahoo.com
How do trains go around bends?
hi this is padhu i just want to know about remote sensing scientist in ISRO, will there a written test or not if there are any model test papers plz post it.