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

Answers were Sorted based on User's Feedback



1 1 1 1 2 1 ..

Answer / tknowledge05

#include<conio.h>
#include<stdio.h>
void main()
{
int a[10],b[10];
int c=1,n=4;
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 ?    1 Yes 0 No

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

1 1 1 1 2 1 ..

Answer / tknowledge05

The above guest is me .. okk....
by the time i solved and executing i was logged out and when i posted the answer it considered guest.......

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Write the control statements in C language

0 Answers   Atos Origin,


what is the function of pragma directive in c?

0 Answers  


Explain a file operation in C with an example.

0 Answers   Amdocs,


What are directives in c?

0 Answers  


What is the output of the following progarm? #include<stdio.h> main( ) { int x,y=10; x=4; y=fact(x); printf(ā€œ%d\nā€,y); } unsigned int fact(int x) { return(x*fact(x-1)); } A. 24 B. 10 C. 4 D. none

2 Answers  






What is period operator in c?

3 Answers   Wipro,


Differentiate between static and dynamic modeling.

0 Answers   Wipro,


When would you use a pointer to a function?

0 Answers  


Explain what does the function toupper() do?

0 Answers  


Discuss the function of conditional operator, size of operator and comma operator with examples.

0 Answers   TCS,


Why main function is special give two reasons?

0 Answers  


What is the process to create increment and decrement stamen in c?

0 Answers  


Categories