We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8998b59 commit 728741fCopy full SHA for 728741f
Assignment-4/FibonaccyPyramid.java
@@ -0,0 +1,40 @@
1
+/*
2
+ * PROGRAM : Java Program to generate fibonaccy pyramid.
3
+ * FILE : FibonaccyPyramid.java
4
+ * CREATED BY: Santosh Hembram
5
+ * DATED : 14-09-20
6
+ */
7
+
8
+import java.util.*;
9
+public class FibonaccyPyramid {
10
+ public static void main(String[] args) {
11
+ int row;
12
+ Scanner sc= new Scanner(System.in);
13
+ System.out.print("Enter the number of rows: ");
14
+ row=sc.nextInt();
15
16
+ printFibonaccy(row);
17
18
+ }
19
20
+ public static void printFibonaccy(int n){
21
+ int f1=0,f2=1,f3=0;
22
23
+ for(int i=1;i<=n;i++) {
24
25
+ for(int j=0;j<i;j++) {
26
27
+ System.out.print(f1+" ");
28
29
+ f3=f1+f2;
30
+ f1=f2;
31
+ f2=f3;
32
33
34
+ System.out.println();
35
36
+ f1=0;
37
+ f2=1;
38
39
40
+}
0 commit comments