Posted by Belajar Pemrograman
Program Bahasa C Perkalian Dengan For
#include<stdio.h>
#define BARIS 2
#define KOLOM 3
main()
{
int hasil[BARIS] [KOLOM];
int baris,kolom,f,a;
printf("\t\t\t -----------------\n");
printf("\t\t\t |TABEL PERKALIAN|\n");
printf("\t\t\t -----------------\n\n");
for (a=0;a<=KOLOM;a++)
printf("%2d",a);
printf("\n");
printf(" -------\n");
for (f=0;f<=BARIS;f++)
{
baris= f+1;
printf("%2d",baris);
for (a=1;a<=KOLOM;a++)
{
kolom= a;
hasil[f][a] =baris*kolom;
printf("%2d",hasil[f][a]);
}
printf("\n");
}
system("pause");
}