Skip to content

Instantly share code, notes, and snippets.

@abdullahainun
Last active December 15, 2023 11:49
Show Gist options
  • Save abdullahainun/4ea081bab8daa771fca1cad4bc1c4593 to your computer and use it in GitHub Desktop.
Save abdullahainun/4ea081bab8daa771fca1cad4bc1c4593 to your computer and use it in GitHub Desktop.

Revisions

  1. abdullahainun renamed this gist Dec 15, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. abdullahainun created this gist Dec 15, 2023.
    29 changes: 29 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #include <stdio.h>

    int main(void)
    {
    printf("## Program Bahasa C Persegi Angka ## \n");
    printf("====================================== \n\n");

    int besar_persegi,baris,kolom, i,j;

    printf("Input besar persegi: ");
    scanf("%d",&besar_persegi);

    printf("\n");

    for(baris=1; baris<=besar_persegi; baris++) {
    if (baris % 2 == 0) {
    for(kolom=besar_persegi; kolom>=1; kolom--) {
    printf(" %d", kolom);
    }
    }else{
    for(kolom=0; kolom<=besar_persegi-1; kolom++) {
    printf(" %d", kolom);
    }
    }
    printf("\n");
    }

    return 0;
    }