Friday, March 29, 2019

C Language Program for to Calculate Quadratic Equation.




BACHELOR OF COMPUTER APPLICATION (B.C.A.) FIRST SEMESTER



Here you will get simple C program 
C Language Program for Calculate Quadratic Equation .
IT IS THE SMALLEST LOGIC USED FOR CODING OF THIS PROGRAM.
IN WHICH YOU CAN CREATE OWN VARIABLES AND FUNCTIONS.
User will input only three numbers and that is equation's number,
then their Quadratic Equation will be calculated and
finally it will be printed on screen.

The program coding is given below.
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
int a,b,c;
float R1,R2;
clrscr();
printf("\nEnter a=");
scanf("%d",&a);
printf("\nEnter b=");
scanf("%d",&b);
printf("\nEnter c=");
scanf("%d",&c);
R1=((-b+sqrt(b*b-4*a*c))/2*a);
printf("\nRoot R1=%f",R1);
R2=((-b-sqrt(b*b-4*a*c))/2*a);
printf("\nRoot R2=%f",R2);
getch();
return 0;
}
Output will be given after you compile it.

No comments:

Post a Comment