If you learn well,you will earn well.

HEllo guys





Hello this is ajksf fjhdfssh hdfjdhf dfhd d hdjshf jhjd f  hfjjf h jhfd dhfjds  h dfjdfhdshfjd hf dfhdsjf
kdhfsf f hgfhsf gdsfhdsgf dfsd gfd  ghdfahgdfuy fegvdfjhdfv

Hello this is ajksf fjhdfssh hdfjdhf dfhd d hdjshf jhjd f  hfjjf h jhfd dhfjds  h dfjdfhdshfjd hf dfhdsjf
kdhfsf f hgfhsf gdsfhdsgf dfsd gfd  ghdfahgdfuy fegvdfjhdfv

Program to find the root of a given equation by using False Position Method. (x3 – 2x – 5 = 0) .

**   Write a program to find the root of a given equation by using False Position Method.
(x3 – 2x – 5 = 0) .
Answer:

#include<stdio.h>
main()
{
    double y1,y2,x,c=0.0001,a,b,y3,y4;//c is the accuracy of the program
    printf("Please enter the two number for finding root in false position method\n");
    scanf("%lf %lf",&a,&b);

    y1=a*a*a-2*a-5;y2=b*b*b-2*b-5;
    if(y1<0&&y2>0)
    {
        if((y1*y2)>0)
        printf("There is no root between the two number");
        else
        {
            do
            {
                x=((a*y2)-(b*y1))/(y2-y1);
                y3=x*x*x-2*x-5;
                if(y3<0)
                a=x;
                else
                b=x;
                }
                while((b-a)>c);
                printf("The root is =%lf",x);
        }
    }


    else if(y1>0&&y2<0)

    {
        y1=b*b*b-2*b-5; y2=a*a*a-2*a-5;

        if((y1*y2)>0)
        printf("There is no root between This two number");
        else
    {
       do
       {
           x=((b*y2)-(a*y1))/(y2-y1);
           y4=(x*x*x)-2*x-5;
           if(y4<0)
           b=x;
           else
           a=x;
       }
       while((a-b)>c);
       printf("This is the root =%lf",x);
    }
    }
    else
    printf("There ti no root between this two number");

    printf("Thanks");

Program to find the root of a linear equation using Bisection Method.

08.. Write a program to find the root of a linear equation using Bisection Method. (xex = 1 )

Answer:


#include<stdio.h>
#include<math.h>
main()
{
   double a,b,fa,t,fb,ft,ac=0.0001;//ac is the accutacy of the prigram
   printf("Enter two value of a  and b as if  the  equation f(a) and f(b) are opposite sign");
   scanf("%lf%lf",&a,&b);

   fa=(a*exp(a))-1;
   fb=(b*exp(b))-1;
   if((fa*fb)<0)
   {
       do
       {
           t=(a+b)/2;
           ft=(t*exp(t))-1;
           if((ft*fa)<0)
           {
               b=t;
               if(ft<0)
               ft=-(ft);
           }
           else if((fa*ft)>0)
           {
           a=t;
           if(ft<0)
           ft=-(ft);
           }
           else if((fa*ft)==0)
           printf("The root of the function=%4lf",t);
           }
           while(ft>=ac);
           printf("The root of the function=%4lf",t);
   }
   else
   printf("There is no root between %lf  and%lf",a,b);



}

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Hello Guys This is my profile. Powered by Blogger.

Popular Posts

Subscribe Via Email

Subscribe to our newsletter to get the latest updates to your inbox. ;-)

Your email address is safe with us!

Email Newsletter

Subscribe to our newsletter to get the latest updates to your inbox. ;-)


Your email address is safe with us!

Scroll To Top