code snippet for creating a pyramids triangle
ex

1
2 2
3 3 3

Answer Posted / rajesh kamar s

void main()

{
int n,i,j;
printf("enter the num of rows\t:");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
for(int k=0;k<n-i;k++)
printf(" ");
for(j=1;j<=i;j++)
printf("%d ",i);
printf("\n");
}
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you avoid including a header more than once?

553


What is the heap in c?

635


Explain the difference between getch() and getche() in c?

558


Why c is called free form language?

560


In c programming language, how many parameters can be passed to a function ?

620






What is the purpose of the statement: strcat (S2, S1)?

636


What is const keyword in c?

734


What is the use of function overloading in C?

666


Write a Program to find whether the given number or string is palindrome.

605


What is the use of structure padding in c?

553


Why double pointer is used in c?

559


What's the difference between constant char *p and char * constant p?

649


What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

579


explain what is an endless loop?

601


How can I split up a string into whitespace-separated fields?

561