Write a program to produce the following output:
1
2 3
4 5 6
7 8 9 10



Write a program to produce the following output: 1 2 3 ..

Answer / ashok kumar

void main()
{
int n,i,j,k=1;
clrscr();
printf("\n Enter a number : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=i;j<n;j++)
printf(" ");
for(j=1;j<=i;j++)
printf(" %d ",k++);
printf("\n");
}
getch();
}

Is This Answer Correct ?    31 Yes 19 No

Post New Answer

More C Interview Questions

Write a program that can show the multiplication table.

0 Answers   Student,


Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.

3 Answers   SilverKey,


What will happen when freeing memory twice

2 Answers  


program to print upper & lower triangle of a matrix

2 Answers   TCS,


What is the newline escape sequence?

0 Answers  






sir, i cannot find the way how to write aprogram by using array on queue

1 Answers   IISIT,


what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }

9 Answers  


Tell me when is a void pointer used?

0 Answers  


Which header file should you include if you are to develop a function which can accept variable number of arguments?

0 Answers   TCS, TISL,


no consistent academics. how to answer the question

0 Answers  


1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision

9 Answers   HCL, Qualcomm,


code for selection sort?

1 Answers  


Categories