Cross shaped pattern

 #include <stdio.h>


int main () {

int totalrow=5, row , colomb;

char name[77];

printf("Enter your name (max 5 character of name) :  ");

gets(name);

for (row = 0 ; row < totalrow; row++){

    for (colomb =0 ; colomb < totalrow; colomb++){

  if ((row == colomb) || ((row+colomb) == (totalrow-1)))


            printf("%c", name[colomb]);

           // printf("*");

             else

                printf(" ");

    }

            printf("\n");

    }






  return 0;

  }

Comments

Popular posts from this blog

Factors : using C

Factorial ! calculation