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

What are extern variables in c?

0 Answers  


What is meant by type casting?

0 Answers  


While compiling a c program,graphics header files are not including in my program..eg: <graphics.h>,what may be the problem...is there any environment settings exists.

2 Answers  


which will be first in c compiling ,linking or compiling ,debugging.

3 Answers   Sonata,


What are the 5 data types?

0 Answers  






Why #include is used in c language?

0 Answers  


how to return 1000 variables from functio9n in c?plz give me code also

6 Answers  


What is c language & why it is used?

0 Answers  


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

0 Answers  


#include<stdio.h> { printf("Hello"); } how compile time affects when we add additional header file <conio.h>.

0 Answers  


What are header files in c programming?

0 Answers  


What does %c do in c?

0 Answers  


Categories