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
What is the purpose of the statement: strcat (S2, S1)?
How can I ensure that integer arithmetic doesnt overflow?
What is the difference between array and pointer?
Is c language still used?
Explain what is a static function?
How can I delete a file?
What is restrict keyword in c?
which is an algorithm for sorting in a growing Lexicographic order
List the variables are used for writing doubly linked list program.
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
What is the benefit of using #define to declare a constant?
Explain the use of 'auto' keyword
How can a program be made to print the name of a source file where an error occurs?
What is a nested formula?