Consider upgrading your compiler. Turbo C is ancient, and no longer supported. Don't use Dev-C++ either, it's also old, outdated and unsupported. There are many better, free, and current alternatives, such as Code::Blocks with MinGW, Pelles C, and MS Visual C++ even has a free version that compiles C. MSVC++ is also a bit outdated (not supporting the standard developed back in 1999), but is still supported/developed by MS.
All the suggestions of the previous posters need to be addressed, as well as the following issues:
Your indentation is non-existent. Indent your code properly, it helps make your code readable. Readable code means fewer mistakes.
Code:
int a[10][10],b[10][10],q,w,e,r,i,j,k,l;
Those are horrible variable names, nobody has any idea what each one of those variables does, including you. You are using the wrong size variables for reading into/printing from matrix b. Also, replace 10 with a #define constant that has a sensible name:
Code:
#define MAX_SIZE 10
...
int matrix1[MAX_SIZE][MAX_SIZE], matrix1_rows, matrix1_cols;
int matrix2[MAX_SIZE][MAX_SIZE], matrix2_rows, matrix2_cols;
Seriously, this will help you immensely. It will make it easy for you and for us to read your code and understand what you are trying to do. The easier it is to read your code, the harder it is for you to make mistakes, and the easier it is for you (and us) to find and fix them. One letter variable names are really only acceptable in a few situations: as a basic loop/array index, or when implementing a mathematical function in which the variable being represented is actually a single letter. Otherwise, your variable names should reflect what the variable is used for.
Code:
scanf("%d",&q,&w);
...
scanf("%d",&e,&r);
Each of those scanf calls only reads in one integer, but you are trying to store it in two integers. If you want the matrix to be a square, read in only one dimension, say matrix1_rows, then simply assign it to matrix1_cols
Code:
scanf("%d", &matrix1_rows);
matrix1_cols = matrix1_rows);
Or, if you want to support rectangular matrices, you need two %d's in your scanf
Code:
scanf("%d%d", &matrix1_rows, &matrix1_cols);
All your for loops for array access are wrong:
Recall, in C, arrays start at 0 and go to size-1. The classic for loop idiom for array access starts at 0 and goes until < (not <=) the size:
Code:
for (i = 0; i < matrix1_rows; i++)
You should print some spaces and new lines between the elements of your matrices, so the output is actually readable. Try something like:
Code:
for (i = 0; i < matrix1_rows; i++) {
for (j = 0; j < matrix1_cols; j++) {
printf("%4d ", matrix1[i][j]);
}
putchar('\n');
}