Multiplication table using two-dimensional array:



#include<stdio.h>
#include<conio.h>
#define ROW 5
#define COLOUMN 5
void main()
{
clrscr();
int row,coloumn,product[ROW][COLOUMN],i,j;
printf("Multiplication table:\n\n");
printf(" ");
for(j=1;j<=COLOUMN;j++)
{
printf("%4d",j);
}
printf("\n");
printf("-----------------------\n");
for(i=0;i
{
row=i+1;
printf("%2d|",row);
for(j=1;j<=COLOUMN;j++){
coloumn=j;
product[i][j]=row*coloumn;
printf("%4d",product[i][j]);
}
printf("\n");
}

getch();
}

No comments:

Post a Comment

Post a Comment