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

what defference between c and c++ ?

6 Answers  


How would you rename a function in C?

0 Answers   Tech Mahindra,


How to implement call back functions ?

3 Answers   HP,


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

0 Answers  


Which one would you prefer - a macro or a function?

0 Answers  






What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

0 Answers  


Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

1 Answers  


declare afunction pointer to int printf(char *)?

1 Answers   HCL,


what are bit fields? What is the use of bit fields in a structure declaration?

0 Answers   Flextronics, TISL, Virtusa,


a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All

3 Answers   Accenture, Digg.com,


c program to input values in a table(using 2D array) and print odd numbers from them

1 Answers  


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

0 Answers   TCS,


Categories