I am really an amateur in C, so do bear with me.

I am trying to write myself a working matrix calculator that can perform addition/subtraction/multiplication. Pretty embarassing though, I found myself unable to display matrix in its aligned form. ie, if it is a 2x2 square matrix with values a,b,c,d = 1,2,3,4, the program should display the matrix as in:

1 2
3 4

But my code displayed it this way:

1
2
3
4

Here's the part of coding. I am using Visual Studio Ultimate 2010 for C++ development, though it is mandatory for me to write this in C. Thanks in advance.


Code:
#include<stdio.h>

int a[5][5],i,j,ra,ca;

main()
{
printf("Input rows and columns of matrix:\n");
scanf("%d%d", &ra,&ca);

printf("Enter the row values for first matrix, followed by column values:\n\n");

for(i = 0; i < ra; i++)
{
	for(j = 0; j < ca; j++)
        {
		scanf("%d", &a[i][j]);
	}
}

printf("You have entered the first matrix as follows:\n");

for(i = 0; i < ra; i++)
{
        for(j = 0; j < ca; j++)
        {
                printf("%d\t",a[i][j]);
	        printf("\n");
	}

}
}

EDIT: Solved the problem already. Sorry for the post.