c - Multiplication table with rows and columns -


how can make multiplication table this? http://i.imgur.com/rr6jsua.png

with code has 1 column.

#include<stdio.h>  int main(){ int i, j;  for(i = 1;i <= 9;i++){    for(j = 1;j <= 9;j++){         printf("%d * %d  = %d\n",i , j,i*j);     } printf("%d * %d = %d\n",i , 10,i*10); printf("\n");  }   return 0; } 

try this:

#include<stdio.h>  int main() {     int i, j;  for(i = 1;i <= 9;i+=3) {    for(j = 1;j <= 10;j++)   {         printf("%2d * %2d = %2d ",i , j,(i)*j);        printf("%2d * %2d = %2d ",i+1 , j,(i+1)*j);        printf("%2d * %2d = %d\n",i+2, j,(i+2)*j);   }   printf("\n"); }  return 0; 

}


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -