Q.11 Generate the following pattern using code in any
language(c/c++/java) for n no. of rows
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Answers were Sorted based on User's Feedback
Answer / balaji ganesh
main()
{
int a[20][20],i,j,n;
clrscr();
a[0][0]=1;
scanf("%d",&n,printf("enter how many rows you want:"));
for(i=0;i<n;i++)
{a[i][0]=1;a[i][i]=1;
for(j=1;j<i;j++)
a[i][j]=a[i-1][j-1]+a[i-1][j];
}
for(i=0;i<n;i++)
{printf("\n\n");
for(j=0;j<=i;j++)
printf("%d ",a[i][j]);
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 3 No |
Answer / sandeep roy
public static void main(String[] args) {
int j=11;
int s=11;
for(int i=1;i<=5;i++) {
if(i==1)
System.out.println(i);
else
{
System.out.println(s);
s=s*j;
}
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
How can I read a binary data file properly?
Can we declare variables anywhere in c?
Write a program for Overriding.
What is an endless loop?
int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }
change to postfix a/(b+c*d-e)
Describe dynamic data structure in c programming language?
4)What would be the output? main() { int num=425; pf("%d",pf("%d",num)); } a)Comp error b)4425 c)4253 d)3435 e)none
to find out the reverse digit of a given number
6 Answers Infosys, Microsoft, TCS, Wipro,
Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.
Write a program to give following output..... ********* **** **** *** *** ** ** * * ** ** *** *** **** **** *********