Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- using namespace std;
- bool perfectsquare(int m){
- if (sqrt(m)*sqrt(m)==m){
- return true;
- }
- else
- return false;
- }
- int main(){
- int a=1;
- int b=1;
- int c=1;
- for (int i=1; i<1000; i++){
- c=a+b;
- cout << c << endl;
- if (perfectsquare(c)){
- cout << c << " is a perfect square " << endl;
- }
- a=b;
- b=c;
- }
- }
Add Comment
Please, Sign In to add comment