Write a program to produce the following output:
1
2 3
4 5 6
7 8 9 10
Answer Posted / 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 View All Answers
Define recursion in c.
What is a c token and types of c tokens?
write an algorithm to display a square matrix.
Tell us bitwise shift operators?
What is the advantage of c?
What is spaghetti programming?
What is new line escape sequence?
What is the difference between struct and union in C?
How many loops are there in c?
Why we use break in c?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
Why should I use standard library functions instead of writing my own?
Why calloc is better than malloc?
Explain how are 16- and 32-bit numbers stored?
Explain the binary height balanced tree?