[PROGRAMMING TECHNIQUE] Lab exercise 2

1.

 

#include <iostream>

 

using namespace std;

int main(){

 

for (int r=0; r <=4; r++){

               for (int c=0;c<=6;c++){

               if (c == 6)cout<<"\n";

               else if (r==1&&c==0|c==5) cout<<"*";

                              else if (r == 2 && c==0|c==5) cout<<"*";

                                             else if (r==0 |r ==3) cout<<"*";

                                                            else cout<<" ";}               

}

 

return 0;

 

}

 

2.

 

#include <iostream>

using namespace std;

 

int main(){

 

int d=11;

              

for(int x=0;x<5;++x){

               for (int y=d; y>0;--y){

                              cout<<"*";}

 

cout<<"\n";

d= --d;

}

 

return 0;             

}