0
By the help of C++ one can make the design like pyramid triangle
if yes so please give its code
3 odpowiedzi
+ 2
C++ program to print pyramid using *.
#include <iostream>
using namespace std;
int main()
{
int i,space,rows,k=0;
cout<<"Enter the number of rows: ";
cin>>rows;
for(i=1;i<=rows;++i)
{
for(space=1;space<=rows-i;++space)
{
cout<<" ";
}
while(k!=2*i-1)
{
cout<<"* "; ++k;
} k=0;
cout<<"\n";
}
return 0;
}
+ 1
thanks birdie it was very helpful