code snippet for creating a pyramids triangle
ex

1
2 2
3 3 3

Answer Posted / k

#include<iostream.h>
int main()
{int i,j,k;
for(i=1;i<=3;i++)
{cout<<"\n";
for(j=1;j<=3-i;j++)
cout<<" ";
for(k=i;k>0;k--)
cout<<i<<" ";
}
return 0;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is array within structure?

583


What are enums in c?

657


What is volatile variable in c?

656


Can we declare variable anywhere in c?

535


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2655






what value is returned to operating system after program execution?

1604


What are the types of functions in c?

570


Explain the meaning of keyword 'extern' in a function declaration.

721


write a c program to calculate sum of digits till it reduces to a single digit using recursion

2718


Where in memory are my variables stored?

635


Differentiate between functions getch() and getche().

620


Write a program to swap two numbers without using the third variable?

597


Explain the ternary tree?

601


What is structure in c definition?

572


Why is not a pointer null after calling free?

591