DevJourney · code I wrote while learning

README.md

Pascal's Triangle

Single File Programming Question

Problem Statement

Sophia is curious about patterns in mathematics and discovers Pascal's Triangle during her studies. To explore its structure, she decides to write a program that generates any specific row. She creates a Java class named PascalTriangle to handle the logic of generating a row.

By using the concept of binomial coefficients, she calculates each value in the row accurately. Her program takes an input number n and prints the nth row of Pascal's Triangle. This helps Sophia visualize combinations and enhances her understanding of number patterns.



Input:

format :

The input consists of an integer n representing the specified row.

Output:

format :

The output displays the specified row of Pascal's Triangle, separated by a space (row starts from 1).

For negative input, print "Invalid Input".

Refer to the sample output for formatting specifications.

Code constraints :

1 ≤ n ≤ 15

Sample test cases :

Input 1:

6

Output 1:

1 5 10 10 5 1

Input 2:

3

Output 2:

1 2 1

Input 3:

-5

Output 3:

Invalid Input