You are on page 1of 1

main.

cpp 05/03/17, 11:27 PM

//programme by warrior MMB


//naam to suna hi hoga
#include<iostream>
#include<math.h>
using namespace std;
float f(float x, float y)
{
float y1=0;
y1=x+y;
return y1;
}
int main()
{
float y, x, h, n, y1;
cout<<"Enter the width of iteration:"<<endl;
cin>>h;
cout<<"Enter the initial X:"<<endl;
cin>>x;
cout<<"Enter the corresponding y value"<<endl;
cin>>y;
cout<<"Enter the final X:"<<endl;
cin>>n;
while( x<n)
{
y1=y+h*f(x,y);
y+=h/2*(f(x,y)+f(x+h,y1));
x=x+h;
}
cout<<"Y("<<x<<") :"<<y<<endl;
}

Page 1 of 1

You might also like