Você está na página 1de 1

#include<iostream>

#include<conio.h>
using namespace std;
void main()
{
float limit,TempAverage=0;
float x1=2,x2=4,x3=6;
cout<<"\nEnter Limit:\n";
cin>>limit;
for(int i=4;i<=limit-4;i++)
{
//Swapping values
TempAverage=(x1+x2+x3)/3;
x1=x2;
x2=x3;
x3=TempAverage;
}

//Showing Output

cout<<"Out=> "<<TempAverage;

getch();
}

Você também pode gostar