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

Tell us two differences between new () and malloc ()?

612


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

976


Differentiate between calloc and malloc.

753


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

664


What is c value paradox explain?

574






Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.

3690


What do you mean by a local block?

628


Explain how can I pad a string to a known length?

652


What is structure padding in c?

624


What is the purpose of scanf() and printf() functions?

721


Why c is a procedural language?

580


What are the 4 types of programming language?

580


Why pointers are used in c?

582


What is the main difference between calloc () and malloc ()?

570


What is use of #include in c?

592