#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2,d;
clrscr();
printf("enter the values of a,b,c");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
x1=(-b+sqrt(d))/2;
x2=(-b-sqrt(d))/2;
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else if(d==0)
{
x1=x2=-b/(2*a);
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else
{
printf("roots are imaginary");
}
getche();
}
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2,d;
clrscr();
printf("enter the values of a,b,c");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
x1=(-b+sqrt(d))/2;
x2=(-b-sqrt(d))/2;
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else if(d==0)
{
x1=x2=-b/(2*a);
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else
{
printf("roots are imaginary");
}
getche();
}
Ajay i need a c++ pgm " the elements of the field F4 are the roots of the polynomial x4-x=x(x-1)(x2+x+1)"
ReplyDelete(x raise to 4 and x raise to 2)
sure sir, but need to clear about the equation should be static that you mentioned
ReplyDeleteor
general purpose..
you can send me mail also, by elaborating the problem
ReplyDeletea programme to find the roots of a polynomial equation in Zn .
DeleteApplications in modern algebra.
for example : Find the roots of a 2x^2 + 5x + 9 in Z7. The roots will be different for different Zn . Like the roots of the given equation in Z7 ,Z8 and Z9..... are different.
Ajay i need a c++ pgm code abt Finite field in Mathematics
ReplyDelete' The elements of the field F4 are the roots of the ploynomial x4-x=x(x-1)(x2+x+1)
x4 means raise to 4
x2 means raise to 2
dear, we can use hit and trial method in any equation to solve, may be of any degree. i will post but takes time. because of busy.. :(. But i shall post the solution.
ReplyDeleteto solve first put all integer values from -32768 to 32767. but it will give only integer roots . not imaginary, not float type
cant do it like if i enter x^2+2x+1 or any other eqn directly
ReplyDeleteC++ program to find Square Root of a Number
ReplyDeleteThanks for sharing this code. It's really helpful. Keep sharing.