Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
802 B
2
Indexable
Never
#include <iostream>

using namespace std;

int main()
{
   int number=0;
   cout<<"enter number"<<endl;
   cin>>number;
   for(int i=0;i<5;++i)
   {
       for(int j=0;j<5;++j)
       {
           if(i==0 && j<number)
           {
               cout<<"*";
           }
           
           if(i==1 && j==0)
           {
               cout<<"*";
           }
           
           if(i==2 && j<number)
           {
               cout<<"*";
           }
           
           if(i==3)
           {
               if(j==number-1)
               {
                   cout<<"*";
               }
               else
               cout<<" ";
           }
           
           if(i==4 && j<number)
           {
               cout<<"*";
           }
       }
       cout<<endl;
   }
    return 0;
}