Skip to content

Commit 728741f

Browse files
authored
Add files via upload
1 parent 8998b59 commit 728741f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Assignment-4/FibonaccyPyramid.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy