Skip to content

Instantly share code, notes, and snippets.

@whalehulk
Created July 27, 2017 17:05
Show Gist options
  • Save whalehulk/2a817d3399af2e371ea318f9a170b79e to your computer and use it in GitHub Desktop.
Save whalehulk/2a817d3399af2e371ea318f9a170b79e to your computer and use it in GitHub Desktop.
multiplication table printer in c
#include<stdio.h>
#include<stdlib.h>
#define colmax 10
#define rowmax 12
int main()
{
int i,j,sum=1;//initializing variables
for(i=1;i<=rowmax;i++)//this iterates rows from 1 to 12
{
for(j=1;j<=colmax;j++)//this iterates colums from 1 to 10 everytime
{
sum=i*j;//and this multiplies all iterated elements to row number
printf("|%4d",sum);//printing the iterated and multiplied elements
}
printf("\n");
printf("------------------------------------------------------|");
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment