Starting from:
$30

$24

Homework 4 SOlution

Files to submit: pascal.c

Time it took Matthew to Complete: 20 mins




All programs must compile without warnings when using the -Wall and -Werror options



Submit only the files requested



Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc



Your program must match the output exactly to receive credit.



Make sure that all prompts and output match mine exactly.



Easiest way to do this is to copy and paste them



All input will be valid unless stated otherwise



Print all real numbers to two decimal places unless otherwise stated



The examples provided in the prompts do not represent all possible input you can receive.



All inputs in the examples in the prompt are underlined



You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
If you have questions please post them on Piazza



Restrictions




No global variables are allowed



Your main function may only declare variables, call other functions, and assign variables values.
For this problem you will be printing out Pascal's Triangle. If you have never heard of Pascal's Triangle recommend checking out its Wikipedia Page.




Assumptions and Requirements




The maximum level that you will have to display is 28



You should NOT use the combinations method for finding the value of an element because it will lead you to getting some wrong answers as the values generated through this method can become larger than the largest possible integer.
You do not have to make your output appear as a triangle



Hints




The animation on the Wikipedia page is very helpful in figuring out how you should get started.












Examples




Please enter how many levels of Pascal's Triangle you would like to see: 2 1
1 1

Please enter how many levels of Pascal's Triangle you would like to see: 4 1
1 1

1 2 1

1331

More products