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


Please Help Members By Posting Answers For Below Questions

How can I do graphics in c?

597


List out few of the applications that make use of Multilinked Structures?

1303


What is #define size in c?

648


C language questions for civil engineering

1245


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

1587






How can this be legal c?

652


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

649


Can we declare variables anywhere in c?

580


What is the difference between far and near in c?

602


What is time complexity c?

568


Why do some versions of toupper act strangely if given an upper-case letter?

634


What is the use of bitwise operator?

691


What is table lookup in c?

630


What is d'n in c?

636


Is c object oriented?

542