0

By the help of C++ one can make the design like pyramid triangle

if yes so please give its code

28th Apr 2017, 6:57 PM
Harshvardhan Pathak
Harshvardhan Pathak - avatar
3 odpowiedzi
29th Apr 2017, 12:15 AM
Hatsy Rei
Hatsy Rei - avatar
+ 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; }
28th Apr 2017, 7:05 PM
Birdie
Birdie - avatar
+ 1
thanks birdie it was very helpful
28th Apr 2017, 7:07 PM
Harshvardhan Pathak
Harshvardhan Pathak - avatar