Answer Posted / guest
#include<conio.h>
#include<stdio.h>
void main()
{
int a[10],b[10];
int c=1,n=5;
a[0]=0;a[1]=1;a[2]=0;
b[0]=0;
printf("Enter no. of rows to print ");
scanf("%d",&n);
for(int i=0;i<n;i++)
{
for(int j=n-2;j<0;j++)
printf(" ");
c++;
for(int k=0;k<c;k++)
{
b[k+1]=a[k]+a[k+1];
}
b[c]=0;
for(int k=1;k<=i+1;k++)
{
printf("%d ",a[k]);
}
printf("\n");
for(int k=0;k<i+3;k++)
a[k]=b[k];
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
What are the different types of control structures?
Can you tell me how to check whether a linked list is circular?
What is const volatile variable in c?
What is the difference between abs() and fabs() functions?
Explain low-order bytes.
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
Can the sizeof operator be used to tell the size of an array passed to a function?
What is the correct code to have following output in c using nested for loop?
Why does everyone say not to use scanf? What should I use instead?
What is abstract data structure in c?
What is the process to create increment and decrement stamen in c?
What is class and object in c?
What is the difference between a function and a method in c?
What is getch?