PROG. TO PRODUCE 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1



PROG. TO PRODUCE 1 1 1 1 2 1 1 ..

Answer / aadhirai r

#include<stdio.h>
#include<conio.h>

void main()
{
int j=2,n,num,b[20],a[20];
a[0]=1; a[1]=2; a[2]=1;
clrscr();
printf("Enter the no of rows");
scanf("%d",&num);
printf(" 1\n");
printf(" 1 1\n");
printf(" 1 2 1\n");
while(j<=num)
{
int i=0;
b[0]=1;
for(n=1;n<=j;n++)
{
b[n]=a[i]+a[i+1];
i++;
}
b[n]=1;
gotoxy(15-(j),j+3);
for(i=0;i<=n;i++)
{
printf("%d ",b[i]);
a[i]=b[i];
}
j++;
}
getch();
}

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Code Interview Questions

main() { int i = 3; for (;i++=0;) printf(“%d”,i); }

1 Answers   CSC,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

9 Answers   Microsoft,


Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,


main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }

2 Answers   Adobe, CSC,


Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,






main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above

5 Answers   HCL,


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


program to find magic aquare using array

4 Answers   HCL,


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


Develop a routine to reflect an object about an arbitrarily selected plane

0 Answers  


I need your help, i need a Turbo C code for this problem.. hope u'll help me guys.? Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine the exact location of each value in the array. Example: Input: Sum of row 1: 6 Sum of row 2: 15 Sum of row 3: 24 Sum of column 1: 12 Sum of column 2: 15 Sum of column 3: 18 Value 1: 3 Value 2: 5 Value 3: 6 Output: Sum of Row 1 2 3 6 4 5 6 15 7 8 9 24 Sum of Column 12 15 18 Note: Your program will not necessary sort the walues in the array Thanks..

0 Answers  


You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.

3 Answers  


Categories