BCA

C LAB :PART A

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10

C LAB : PART B

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10

Write a C Program to find the roots of quadratic equation (if else ladder) .

  
   /*Write a C Program to find the roots of quadratic equation (if else ladder)  */
   
# include< stdio.h>
# include< conio.h>
# include< math.h>
main (){
   float a,b,c,r1,r2,d;
   printf (“enter the values of a b c”);
   scanf (“ %f %f %f”, &a, &b, &c);
   d= b*b – 4*a*c;
   if (d>0){
      r1 = -b+sqrt (d) / (2*a);
      r2 = -b-sqrt (d) / (2*a);
      printf (“The real roots = %f %f”, r1, r2);
   }
   else if (d= =0){
      r1 = -b/(2*a);
      r2 = -b/(2*a);
      printf (“roots are equal =%f %f”, r1, r2);
   }
   else
      printf(“Roots are imaginary”);
   getch ();
}