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 the function of volatile in c language?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
Why c is known as a mother language?
What are the preprocessor categories?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
find out largest elemant of diagonalmatrix
Do you know the use of 'auto' keyword?
List some of the dynamic data structures in C?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
How to write c functions that modify head pointer of a linked list?
What is file in c language?
Explain function?
What is the size of enum in c?
What is a good data structure to use for storing lines of text?
What are dangling pointers in c?