Skip to main content

Posts

Showing posts from June, 2019

pattern printing in c/c++

pattern printing in c/c++- ganesha pattern printing- Given the number of rows and columns, print the corresponding swastika pattern using loops. Note :  The number of rows and columns should be same and an odd number. This will generate a perfect swastika pattern. Input : row = 7, column = 7 Output: * * * * * * * * * * * * * * * * * * * * * * * * * #include<iostream> using namespace std; int main() {     int n,star,space,i=0,row=1;     cin>>n;     star=(n/2)+1;     space=(n/2)-1;     for(row=1;row<=1;row++)     {         cout<<"*";         for(i=1;i<=space;i++)         {             cout<<" ";         }         for(i=1;i<=star;i++)         {             cout<<"*";         }         cout<<endl;     }     while(row<=(n/2))     {       cout<<"*";       for(i=1;i<=space;i++)       {           cout<<" ";