clanguage07@gmail.com

clanguage07@gmail.com

Saturday, June 16, 2012

Quadratic form .c- program

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
  float a,b,c,r1,r2,d;
  clrscr();
  printf("\n enter values of a,b,c:");
  scanf("%f%f%f",&a,&b,&c);
  if(a==0)
  printf("enter value should not be zero");
  else
  {
  d=b*b-4*a*c;

  if(d>0)
  {
  r1=-b+sqrt(b*b-4*a*c)/2*a;
  r2=-b-sqrt(b*b-4*a*c)/2*a;
  printf("roots are real and unequal \n");
  printf("r1=%f\n r2=%f",r1,r2);
  }
  else
  {
  if(d==0)
  {
  r1=-b/(2*a);
  r2=-b/(2*a);
  printf("\n roots are real and equal");
  printf("\n root=%f\n",r1);
  printf("\n root=%f\n",r2);
  }
  else
  printf("roots are imaginary");
  }
 }
 getch();
 }

No comments:

Post a Comment

GET MORE INFORMATION

http://ads.qadservice.com/t?id=c2168e05-8974-4816-872a-91936ff7379d&size=1024x768&drct=true