Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Numerical MethodsRSS Feeds

SUCCESSIVE APPROXIMATION METHOD

Posted By: Abbie Hughes     Category: C Programming     Views: 7135

Write a program of SUCCESSIVE APPROXIMATION METHOD

Code for SUCCESSIVE APPROXIMATION METHOD in C Programming

#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int user_power,i=0,cnt=0,flag=0;
int coef[10]={0};
float x1=0,t=0;
float x2=0;

void main()
{

    clrscr();

    printf("\n\n\t\t\t PROGRAM FOR SUCESSIVE APPROXIMATION");

    printf("\n\tINTIAL X1---->");
    scanf("%f",&x2);


/*************************************************************************/
printf("\n ******************************************************"); printf("\n ITERATION X1 FX1 "); printf("\n **********************************************************"); do { cnt++; x1=x2; x2=(2-(log10(x1))); printf("\n %d %.3f %.3f ",cnt,x1,x2); }while((fabs(x2 - x1))>=0.0001); printf("\n\t THE ROOT OF EQUATION IS %f",x1); getch(); } /*******************************OUTPUT**********************************/
PROGRAM FOR SUCESSIVE APPROXIMATION INTIAL X1---->10 ******************************** ITERATION X1 FX1 ******************************** 1 10.000 1.000 2 1.000 2.000 3 2.000 1.699 4 1.699 1.770 5 1.770 1.752 6 1.752 1.756 7 1.756 1.755 8 1.755 1.756 9 1.756 1.756 ******************************** THE ROOT OF EQUATION IS 1.755633
  
Share: 


Didn't find what you were looking for? Find more on SUCCESSIVE APPROXIMATION METHOD Or get search suggestion and latest updates.

Abbie Hughes
Abbie Hughes author of SUCCESSIVE APPROXIMATION METHOD is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!