Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[])
- {
- int n=2;
- int Xn;
- int i, j;
- int E; //epsilon
- int a[100];
- i = 0;
- printf("Enter the E: ");
- scanf(" %d", &E);
- printf("%d\n", 2);
- do
- {
- a[0]=2;
- a[1]=5;
- Xn=2*a[n-2]+a[n-1];
- a[n]=Xn;
- for(i=0;i<n;i++)
- {
- printf("%d ", a[i]);
- }
- n++;
- printf("\n");
- }
- while(Xn<E);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement