PROGRAM MENAMPILKAN DERET BILANGAN

Hasil :

Masukan x = 4

1 2 3 4

2 4 6

3 6

4

3 6

2 4 6

1 2 3 4

 

 

#include <stdio.h>

#include <conio.h>

void main ()

{

clrscr();

int baris, kolom , hasil, x ,y ,m,n,k;

printf(“masukkan x = “);

scanf(“%3d”,&x);

y= x+1;

for (baris =  1 ; baris <= y ; baris++ )

{ for (kolom = 1 ; kolom <= y-baris ; kolom++)

{ hasil = kolom * baris ;

printf(“%3d”,hasil);

}

printf(“\n”);

}

for (m = 4 ; m >= 1 ; m–)

{ for (n = 1 ; n <= y-m ; n++)

{ k=m*n ;

printf(“%3d”,k);

}

printf(“\n”);

}

getch();

}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s