write a program that prints a pascal triangle based on the
user input(like how many stages) in an efficient time and
optimized code?
Answer Posted / abhinav
call this recursive routine:
void pascal(int n)
{
if(n==1) {
printf("%d \n", n);
return;
}
pascal(n-1);
int i;
for(i=1;i<=n; i++)
printf("%d ",i);
for(i=n-1;i>=1; i--)
printf("%d ",i);
printf("\n");
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is c value paradox explain?
What are the benefits of c language?
Write a program to reverse a linked list in c.
How can I do graphics in c?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
What is the use of ?
There seem to be a few missing operators ..
Is there sort function in c?
Why is python slower than c?
What is array in c with example?
What is the advantage of c?
i want to know the procedure of qualcomm for getting a job through offcampus
How can I find out the size of a file, prior to reading it in?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
List the difference between a 'copy constructor' and a 'assignment operator' in C?