Multiplication Table
#include<stdio.h>
#include<conio.h>
#define ROWS 5
#define COLUMS 5
main()
{
int row,colum,product[ROWS][COLUMS];
int i,j;
printf("Multiplication Table\n\n");
printf(" ");
for(j=1;j<=COLUMS;j++)
printf("%4d",j);
printf("\n");
printf(" ----------------------\n");
for(i=0;i<ROWS;i++)
{
row=i+1;
printf("%2d |",row);
for(j=1;j<=COLUMS;j++)
{
colum=j;
product[i][j]=row*colum;
printf("%4d",product[i][j]);
//printf("----------------------\n");
}
printf("\n");
}
}
#include<stdio.h>
#include<conio.h>
#define ROWS 5
#define COLUMS 5
main()
{
int row,colum,product[ROWS][COLUMS];
int i,j;
printf("Multiplication Table\n\n");
printf(" ");
for(j=1;j<=COLUMS;j++)
printf("%4d",j);
printf("\n");
printf(" ----------------------\n");
for(i=0;i<ROWS;i++)
{
row=i+1;
printf("%2d |",row);
for(j=1;j<=COLUMS;j++)
{
colum=j;
product[i][j]=row*colum;
printf("%4d",product[i][j]);
//printf("----------------------\n");
}
printf("\n");
}
}
No comments:
Post a Comment