Guest User

Untitled

a guest
Jan 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdio.h>
  4. using namespace std;
  5.  
  6. bool perfectsquare(int m){
  7. if (sqrt(m)*sqrt(m)==m){
  8. return true;
  9. }
  10. else
  11. return false;
  12. }
  13.  
  14. int main(){
  15. int a=1;
  16. int b=1;
  17. int c=1;
  18. for (int i=1; i<1000; i++){
  19. c=a+b;
  20. cout << c << endl;
  21. if (perfectsquare(c)){
  22. cout << c << " is a perfect square " << endl;
  23. }
  24. a=b;
  25. b=c;
  26. }
  27. }
Add Comment
Please, Sign In to add comment