123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Roots of Quadratic

--------------------------------------------------------------------------------

Description : To find real roots for a quadratic equation!!

Code :
//PROGRAM TO CALCULATE THE REAL ROOTS OF A QUADRATIC EQUATION.

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a,b,c;
float d,r1,r2;
printf("
ENTER THE VALUE OF A,B,C TO FORM THE QUADRATIC EQUATION
AX^2+BX+C:<BR>);
printf("A=");
scanf("%d",&a);
printf("
B=");
scanf("%d",&b);
printf("
C=");
scanf("%d",&c);
d=(b*b)-4*a*c;
if(sqrt(d)<0)
printf("
NO REAL ROOT EXISTS:");
else
{
printf("
REAL ROOTS EXIST:");
r1=((-b)+sqrt(d))/(2*a);
r2=((-b)-sqrt(d))/(2*a);
printf("
THE REAL ROOTS OF THE EQUATION ");
printf("%d",a);
printf("x^2+");
printf("%d",b);
printf("x+");
printf("%d",c);
printf(" ARE :%f",r1);
printf(" AND %f",r2);
}
getch();
}

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG