1
1 1
1 2 1
1 3 3 1
1 4 6 4 1



1 1 1 1 2 1 ..

Answer / 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

More C Interview Questions

find out largest elemant of diagonalmatrix

0 Answers  


What is the relation between # and include<stdio.h>

5 Answers   HCL,


Example of friendly function in c++

2 Answers  


Explain what is the use of a semicolon (;) at the end of every program statement?

0 Answers  


what is the difference between procedure oriented and object oriented progaming language

1 Answers  






What do mean by network ?

0 Answers  


What is restrict keyword in c?

0 Answers  


what is the purpose of the code, and is there any problem with it. bool f( uint n ) { return (n & (n-1)) == 0; }

1 Answers   Google,


How can I make sure that my program is the only one accessing a file?

0 Answers  


pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used.

4 Answers   Persistent, Valyoo,


What is null pointer in c?

0 Answers  


I have seen function declarations that look like this

0 Answers  


Categories