XMPP JavaScript Library

Program to find the roots of a quadratic equation.

Program to find the roots of a quadratic equation.

1 /*program to find the roots of a quardatic equation*/
2 #include <stdio.h>
3 #include <math.h>
4 #include <conio.h>
5
6 /*Function to calculate the roots of quardatic*/
7 void quadaratic_root(int a,int b,int c)
8 {
9 double x,y;
10 printf("\n");
11 x=(-b+(pow(pow(b,2)-4*a*c,.5)))/(2*a);
12 y=(-b-(pow(pow(b,2)-4*a*c,.5)))/(2*a);
13
14 printf("%lf and %lf",x,y);
15 }
16 void main()
17 {
18 int a,b,c;
19 printf("Enter value for a: ");
20 scanf("%d",&a);
21
22 printf("Enter value for b: ");
23 scanf("%d",&b);
24
25 printf("Enter value for c: ");
26 scanf("%d",&c);
27
28 if(pow(b,2)-4*a*c<0)
29 {
30 printf("Roots can't be find");
31 }
32 else if(pow(b,2)-4*a*c==0)
33 {
34 printf("Single Root");
35 quadaratic_root(a,b,c);
36 }
37 else if(pow(b,2)-4*a*c>0)
38 {
39 printf("Double Root");
40 quadaratic_root(a,b,c);
41 }
42 getch();
43 }
Add Your Comment
   
    Yes! I want to receive all comments by email

  by elakkiya on 28-Sep-2014 02:26 pm
thankyou&bye
  • Reply
  •  0 Like
  •  1 Dislike
  • Report
  by xyz on 28-Sep-2014 02:24 pm
good
  • Reply
  •  0 Like
  •  1 Dislike
  • Report
  by vijay tembre on 22-May-2011 09:50 am
the program is very usefull for the first year BE Students for computer programming subject......One more thing pls tell me download or copy paste the videos in video section.....vijay tembre BE(Production)
  • Reply
  •  5 Like
  •  4 Dislike
  • Report
  by Sachin Puri on 30-May-2011 08:52 pm
Sorry to reply you late. Thanks for liking the content. If you want to publish any content on this site you can male me that at mail@sachinpuri.com
  • Reply
  •  4 Like
  •  4 Dislike
  • Report

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home2/sachinpu/public_html/pages/algorithm.php on line 33

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home2/sachinpu/public_html/pages/algorithm.php on line 33

Warning: include(): Failed opening 'ads/adbrite_300_250.php' for inclusion (include_path='.:/opt/cpanel/ea-php56/root/usr/share/pear') in /home2/sachinpu/public_html/pages/algorithm.php on line 33

About the author

Sachin Puri Hi, I am Sachin Puri, I am a Programmer. Programming is my work and it is the thing i like to do most in my free time.
You can catch Sachin Puri at