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
How can I do graphics in c?
List out few of the applications that make use of Multilinked Structures?
What is #define size in c?
C language questions for civil engineering
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
How can this be legal c?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Can we declare variables anywhere in c?
What is the difference between far and near in c?
What is time complexity c?
Why do some versions of toupper act strangely if given an upper-case letter?
What is the use of bitwise operator?
What is table lookup in c?
What is d'n in c?
Is c object oriented?