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

how to find anagram without using string functions using only loops in c programming

0 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,


what is an array

5 Answers  


how to print 2-D array using a single for loop?

2 Answers   Mind Tree, TCS, Value Labs,


with out using main how to execute the program?

2 Answers  






Not all reserved words are written in lowercase. TRUE or FALSE?

0 Answers  


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

3 Answers  


How do we swap or interchange any 2 numbers without using Temporary variable...Anybody can pls answer it.. Thanks in Advance

8 Answers  


What is the use of volatile?

0 Answers  


what is Array?

3 Answers  


Which is better oop or procedural?

0 Answers  


why array index always starts from zero??

4 Answers   TCS,


Categories