Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. package helloworld;
  2. import java.io.*;
  3. import java.util.Scanner;
  4. /**
  5. * @author pradeep_7
  6. */
  7. public class Helloworld {
  8. public static void main(String[] args)throws IOException {
  9. Scanner hello = new Scanner(System.in);
  10. int a=0,b=1,c=0,n,i;
  11. n= hello.nextInt();
  12. System.out.print(a+" "+b);
  13. for(i=2;i<n;i++)
  14. {
  15. c=a+b;
  16. a=b;
  17. b=c;
  18. System.out.print(" "+c);
  19.  
  20. }
  21. }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement