- 3
Guys I need your help since all of you here are professionals while me Im just a student. A newbie in this Type of Course
How to make a program using FOR LOOP create a Fibonacci sequence and MULTIPLICATION TABLE . But FOR loop will be used Twice only. 1,1,2,3,5,8,13,21,34, PLEASE. HELP ME GUYSS .
3 odpowiedzi
+ 1
If you know arrays is simple but you have to introduce how many times you want it to do the operation. otherwise it will never stop.
#include <iostream>
using namespace std;
int i,v[1000],j,n;
int main() {
cin>>n;
v[1]=1;
for(i=2;i<=n;i++)
v[i]=v[i-1]+v[i-2];
for(i=1;i<=n;i++)
cout<<v[i]<<" ";
return 0;
}
0
this is a program . where you can set the values.
#include < iostream.h >
int main()
{
int n, first = 0, second = 1, next, c;
cout<<"Enter the number of terms\n";
cin>>n;
cout<<"First"<<n<<"terms of Fibonacci series are :-\n";
for ( c = 0 ; c < n ; c++ )
{
if ( c < = 1 )
next = c;
else
{
next = first + second;
first = second;
second = next;
}
cout<<next<<"\n";
}
return 0;
}
- 2
Plss help me😢