Program untuk membuat tanda silang dengan masukan harus berupa bilangan ganjil

 /******************************************************************************


Welcome to GDB Online.

GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,

C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.

Code, Compile, Run and Debug online from anywhere in world.


*******************************************************************************/

#include <stdio.h>


int main()

{

  int i;

  int j;

  printf("Masukan bilangan: \n");

  int N;

  scanf("%d",&N);

  if(N%2 == 1)

  {

      for(i=1;i<=N;i++)

  {

      for(j=1;j<=N;j++)

      {

          if(i==j)

          {

              printf("*");

          }else if(i+j == N+1)

          {

              printf("*");

          }else

          {

              printf(" ");

          }

          

      }

   

      printf("\n");

  }  

  }

  else

  {

      printf("Error");

  }

  


}


Komentar

Postingan populer dari blog ini

Pentingnya Mendapatkan Sertifikasi di Bidang IT/Sebagai Programmer

Pengantar Java Swing Bagian 1

Pengenalan UML