Skip to content

xedi1/Pascal-Triangle-Generator-in-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โœจ Pascal Triangle Generator in Java โœจ

> A simple and beautiful Java console application that generates the famous Pascal Triangle ๐Ÿ”บ

---

๐Ÿ“Œ About Project

This project creates a Pascal Triangle (called "Paskal" in the code) using Java arrays and loops.

The program:

โœ… Takes number of rows from user
โœ… Generates Pascal Triangle dynamically
โœ… Prints the triangle in console output


๐Ÿš€ Features

๐ŸŒŸ Object-Oriented Java
๐ŸŒŸ Dynamic 2D Arrays
๐ŸŒŸ User Input with Scanner
๐ŸŒŸ Clean Console Output
๐ŸŒŸ Beginner Friendly Project


๐Ÿง  How Pascal Triangle Works

Each number is calculated using:

Array[i][j] = Array[i-1][j-1] + Array[i-1][j]

Example:

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

๐Ÿ’ป Source Code

rpaskal.java

โ–ถ๏ธ How To Run

1๏ธโƒฃ Compile

git clone https://github.com/xedi1/Pascal-Triangle-Generator-in-Java
javac rpaskal.java

2๏ธโƒฃ Run

java rpaskal

๐Ÿ–ฅ๏ธ Example Output

======= Paskal Creation ==========
Enter Number Rows:
5

Paskal Matrix|
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

๐Ÿ› ๏ธ Technologies Used

Technology Usage
โ˜• Java Main Programming Language
๐Ÿงฎ Arrays Store Triangle Values
๐Ÿ” Loops Generate Triangle
โŒจ๏ธ Scanner User Input

๐Ÿ“š Learning Concepts

This project helps beginners learn:

โœ… Java Classes & Objects
โœ… Constructors
โœ… Methods
โœ… Nested Loops
โœ… Dynamic Arrays
โœ… Console Input/Output


๐ŸŒŸ Future Improvements

๐Ÿ”น Better triangle formatting
๐Ÿ”น Center alignment output
๐Ÿ”น GUI version using Java Swing
๐Ÿ”น Save output to file


๐Ÿ‘จโ€๐Ÿ’ป Author

Made with Edi by using Java


โญ Support

If you like this project:

โญ Star the repository
๐Ÿด Fork the project
๐Ÿ› ๏ธ Improve the code


About

A simple and beautiful Java console application that generates the famous Pascal Triangle ๐Ÿ”บ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages