Er.puneet Kumar Tyagi

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Er.puneet Kumar Tyagi as PDF for free.

More details

  • Words: 133
  • Pages: 2
Er.Puneet kumar tyagi

AIM :- Write a program for BISECTION METHOD #include<stdio.h> #include #include<math.h> float f(float x) { return((-0.9)*(x*x)+(1.7)*x+2.5); } void main() { float x1,x2,x3,y1,y2,y3; int i,n; clrscr(); printf("\n enter the value of initial guess x1"); scanf("%f", &x1); printf("\n enter the value of another guess x2"); scanf("%f", &x2); printf("\n enter the number of iterations ="); scanf("%d", &n); y1=f(x1); y2=f(x2); while(y1*y2>0) { printf("\n enter the value of x1 again ="); scanf("%f", &x1); printf("\n enter value of x2 again ="); scanf("%f", &x2); y1=f(x1); y2=f(x2); } for(i=1;i<=n;i++) { x3=((x1+x2)/2);

Er.Puneet kumar tyagi

y3=f(x3); if(y1*y3<0) { x2=x3; y2=y3; } else { x1=x3; y1=y3; } } printf("\n the root x3=%f", x3); getch(); }

OUTPUT Enter the value of initial guess x1=2.8 Enter the value of initial guess x2=3 Enter the number of iterations =3 The root x3 =2.875000

Related Documents

Er.puneet Kumar Tyagi
June 2020 7
Navin Tyagi
June 2020 19
Pooja Tyagi
June 2020 17
Kumar
July 2020 28
Kumar
October 2019 43
Kumar
May 2020 28