Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class BLento {
- static boolean esFibo(int numero) {
- int a=0, b=1, f=0;
- while (f < numero) {
- a = b;
- b = f;
- f = a+b;
- }
- return f == numero;
- }
- public static void main(String[] args) {
- Scanner cin = new Scanner(System.in);
- int n = cin.nextInt();
- while ( (n--) > 0) {
- int a = cin.nextInt();
- if (esFibo(a)) {
- System.out.print(a + " ");
- }
- System.out.print(a + " ");
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement