cpp 8
program must display whether the number entered belongs to the Fibonacci serie or nat
Code:
#include <iostream> using namespace std:
int main()
int n cout << "Enter an integer: ; cin>> n int a 0; int b = 1; int e
while (a<n)
Ica: a=b; bec:)
if (ason)
cout << "Number belongs to the Fibonacci Series\n";
else
cout <<
"Number
does
not
belong
to
the
Fibonacci
Series\n": return 0:)
Output:
Enter an integer:0 Number belongs to the Fibonacci Series
Enter an integer: 10 Number does not belong to the Fibonacci Series
Comments
Post a Comment