Generate a Padovan sequence of numbers. The Padovan sequence issimilar to the Fi
ID: 3609282 • Letter: G
Question
Generate a Padovan sequence of numbers. The Padovan sequence issimilar to the Fibonacci sequence and is defined as follows:P(0) = P(1) = P(2) = 1
P(n) = P(n-2)+P(n-3) for n >= 3
Your program should prompt the user to enter how many Padovannumbers they would like to generate. You instruct the user toselect a number from 3 to 100. These limits should be defined asconstants in your program. Your program should calculate all of thedesired Padovan numbers using a for loop and store them in anarray. Then, a second for loop should be used to output all of thecalculated numbers. If the user enters a number less than 3, anappropriate error message should be printed and the program shouldstop. Similarly, if the user enters a number greater than 100, adifferent error message should be printed. Finally, if the numberis in the correct range, the program should calculate the requiredPadovan numbers.
Explanation / Answer
please rate - thanks this is recursive, if you can't use recursive let me know and I'lltry it iteratively #include #include double P(double); int main() { double p[100],n; int i; printf("Enter the order of the Padovan number between3 and 100: negative to exit "); scanf("%lf",&n); while(n>=0) {if(n300) printf("number out of range - retry "); else {for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.