#include<stdio.h>
#include<stdlib.h>
int main(){
int jumlahbaris, jumlahkolom, baris, kolom, x;
ulang:
printf("masukan jumlah baris = ");
scanf("%d", &jumlahbaris);
printf("masukan jumlah kolom = ");
scanf("%d", &jumlahkolom);
printf("\n======================");
printf("\ntabel kosong");
printf("\n======================\n");
x=jumlahkolom;
for (baris=0; baris<=jumlahbaris; baris++){
for(kolom=0; kolom<=jumlahkolom; kolom++){
if (baris==0){
if(kolom==0){
printf("\t");
}
else{
printf("%d\t", kolom);
}
}
else if(kolom==0){
printf("%d\t", baris);
}
else if(kolom< x+1){
printf("\t");
}
else{
printf("%d\t", baris*kolom);
}
}
printf("\n");
x--;
}
printf("\n=======================\n");
system ("pause");
system ("cls");
goto ulang;
return 0;
}
hasilnya seperti ini:

sekian, semoga dapat membantu :)
0 Comments