Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.math.BigInteger;
- class man {
- public static void main(String[] args) {
- number a = new number();
- Hightnumber h = new Hightnumber();
- h.maxnumber(h.max());
- h.roundFibonacci(h.round());
- }
- }
- class number extends printfuck implements prototypenumber
- {
- @Override
- public BigInteger input() {
- Scanner in = new Scanner(System.in);
- p("Input Number: ");
- BigInteger number = BigInteger.valueOf(0);
- number = in.nextBigInteger();
- return number;
- }
- @Override
- public BigInteger frist() {
- BigInteger frist = input();
- return frist;
- }
- public BigInteger two() {
- BigInteger two = input();
- return two;
- }
- }
- class Hightnumber extends printfuck implements prototypeworking {
- @Override
- public BigInteger max() {
- Scanner in = new Scanner(System.in);
- System.out.print("Max Fibonacci : ");
- BigInteger maxi = in.nextBigInteger();
- return maxi;
- }
- @Override
- public void maxnumber(BigInteger maxi) {
- number n = new number();
- BigInteger One = n.frist();
- BigInteger Two = n.two();
- p(" " + One + "\n" + " " + Two + "\n" + "\n+==================+\n");
- BigInteger three;
- long count = 0;
- while (true) {
- three = One.add(Two);
- One = Two;
- Two = three;
- int res = 0;
- res = three.compareTo(maxi);
- if (res == 1) {
- break;
- }
- p(" " + three + "\n");
- count++;
- }
- p("round number: " + (count + 2)+"\n");
- }
- public long round() {
- Scanner in = new Scanner(System.in);
- p("Round Fibonacci : ");
- long round = in.nextLong();
- return round;
- }
- public void roundFibonacci(long round) {
- number n = new number();
- BigInteger One = n.frist();
- BigInteger Two = n.two();
- p(" " + One + "\n" + " " + Two + "\n" + "\n" + "+==================+\n");
- BigInteger three;
- long count = 0;
- for (int i = 0; i < round; i++) {
- three = One.add(Two);
- One = Two;
- Two = three;
- p(" " + three + "\n");
- }
- }
- }
- class printfuck {
- static void p(String s) {
- System.out.print(s);
- }
- }
- interface prototypeworking
- {
- public Object max();
- public void maxnumber(BigInteger thisBigInteger);
- }
- interface prototypenumber
- {
- public Object input();
- public Object frist();
- public Object two();
- }
Advertisement
Add Comment
Please, Sign In to add comment