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 |
How do you write a program which produces its own source code as its output?
count the numbers between 100 and 300, that star with 2 and ends with 2
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
what is the stackpointer
Hi can anyone tell what is a start up code?
Can a pointer be null?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Write a program to swap two numbers without using third variable?
Can you assign a different address to an array tag?
explain what is fifo?
Given a string write a program to print all alphabetical characters in the order of their occurance first,followed by the sum of the numeric characters then followed by the special characters in the order of their occurance.
1 Answers College School Exams Tests, Wipro,
Explain how do you sort filenames in a directory?