❤️Chandigarh Escort Service☎️9815457724☎️ Call Girl service in Chandigarh☎️ C...
Metnum
1. Code for MILNE'S METHOD in C Programming
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define MAX 20
float equation(float x,float y)
{
return(1+(y*y));
}
void main()
{
FILE *fp;
int i=0,count=-1;
float lower,upper,h,y1,xvalue[MAX],yvalue[MAX],result;
float function[MAX],search,final,temp;
fp=fopen("milne.dat","w");
clrscr();
printf("MILNE'S METHOD ");
fprintf(fp,"MILNE'S METHOD ");
printf("n");
fprintf(fp,"n");
printf("nEnter the lower bound of x : ");
fprintf(fp,"nEnter the lower bound of x : ");
scanf("%f",&lower);
fprintf(fp,"%f",lower);
printf("nEnter the upper bound of x : ");
fprintf(fp,"nEnter the upper bound of x : ");
scanf("%f",&upper);
fprintf(fp,"%f",upper);
printf("nEnter the value of y(lower) : ");
fprintf(fp,"nEnter the value of y(lower) : ");
scanf("%f",&y1);
fprintf(fp,"%f",y1);
printf("nEnter the value of h : ");
fprintf(fp,"nEnter the value of h : ");
scanf("%f",&h);
fprintf(fp,"%f",h);
printf("nEnter the value of x for which you want to find y :");
fprintf(fp,"nEnter the value of x for which you want to find y :");
scanf("%f",&search);
fprintf(fp,"%f",search);
xvalue[i]=lower;
yvalue[i]=y1;
for(i=0;xvalue[i]<=upper;i++)
{
xvalue[i+1]=xvalue[i]+h;
}
for(i=0;xvalue[i]<=upper;i++)
{
result=equation(xvalue[i],yvalue[i]);
2. yvalue[i+1]=yvalue[i]+(h*result);
}
printf("nn");
fprintf(fp,"nn");
printf("The table is ");
fprintf(fp,"The table is ");
printf("nn");
fprintf(fp,"nn");
printf(" i x y f(x,y) ");
fprintf(fp," i x y f(x,y) ");
printf("nn");
fprintf(fp,"nn");
for(i=0;xvalue[i]<=upper;i++)
{
function[i]=equation(xvalue[i],yvalue[i]);
printf(" %d. %.4f %.4f %.4f ",i,xvalue[i],yvalue[i],function[i]);
fprintf(fp," %d. %.4f %.4f %.4f
",i,xvalue[i],yvalue[i],function[i]);
count=count+1;
printf("n");
fprintf(fp,"n");
}
yvalue[search]=yvalue[count-3]+(4*h/3)*((2*function[count-2])-
(function[count-1])+(2*function[count]));
final=equation(search,yvalue[search]);
yvalue[search]=yvalue[count-1]+(h/3)*((function[count-
1])+(4*function[count])+final);
printf("nn");
fprintf(fp,"nn");
printf("Approximate value is : %.4f ",yvalue[search]);
fprintf(fp,"Approximate value is : %.4f ",yvalue[search]);
fclose(fp);
getch();
}