Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a cpp code to find nth term of Recamans Sequence #157

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions recammans sequence.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <iostream>
using namespace std;
int main()
{
// Code to find nth term of a Recam�n's Sequence //
int n,x=0;
cout<<" Please enter the number of terms you wish to see in the Recam�n's Sequence : ";
cin>>n;
cout<<endl<<endl;
cout<<" The first n terms of the Recam�n's Sequence are as follows:"<<endl;
cout<<x<<" ";
for(int i=1; i<n;i++)
{
if(x-i>0)
x=x-i;
else
x=x+i;
cout<<x<<" ";
}
fflush(stdin);
getchar();
return 0;
}



Binary file added recammans sequence.exe
Binary file not shown.