vendredi 6 décembre 2019

Whats wrong with this Pattern Program in C

I was creating the following pattern through C Language

Pattern: https://i.imgur.com/7ckxM7rl.png

My Code:

#include <stdio.h>
int main()
{
int i=1, j=1,k=1;
while(i<=6)
{
    if(i!=1 || i!=6)
    {
     while(j<=5)
     {
         if(j!=3)
         {
             printf("*");
         }
         else
         {
             printf(" ");
         }
         j++;
     }
    }
    else
    {
      while(k<=5)
      {
          printf("*");
          k++;
      }
    }
    i++;
 }return 0;}

Please help me by describing the error I am doing. Please help me with the right code.

Aucun commentaire:

Enregistrer un commentaire