Untitled
unknown
plain_text
a year ago
447 B
13
Indexable
#include <iostream>
using namespace std;
int main(){
int fib;
int temp;
int num1 = 0, num2= 1;
int requiredLoop=1;
cout<<"Enter Number: ";
cin>>fib;
cout<<num1<<endl;
while (fib > num1){
temp = num1;
num1 = num2;
num2 = temp + num2;
if (!(fib > num1)&&!(fib == num1)){
requiredLoop = 0;
break;
}
cout<<num1<<endl;
requiredLoop++;
}
cout<<"Required Loop: "<<requiredLoop;
return 0;
}Editor is loading...
Leave a Comment