General: Decimal form is not a well recognised description of data. There is binary, raw data in memory, and text, something that is human readable. If using text you may want to indicate what base to display the number in but decimal would be assumed if you left it out since decimal is for humans to read and decimal is the way they normally read numbers. You seem to be saying that you want to read a file that contains binary, non-human readable, data and write it to a file that contains text, human readable, data using base 10. However that is the reverse of what your program appears to attempt to do so I am a little confused.
General: properly indenting your code would make it more readable.
Line 1: main returns int
Line 4: int a[100][100]; is logically incorrect. You are reading a list of integers not a matrix of integers. Further down, at line 31, you read the separate bytes of each integer into different entries in a without ever combining them.
Line 9/18: gets is not safe especially when you have only provided 20 byte buffers to contain the file name.
Line 26: n is never initialised to anything, it has a random value.
Line 30: You are using fscanf to read a file that you have said is binary, fscanf is for reading text data. At line 31 you then attempt some strange maths which suggests you may think you are trying to read binary data. To read binary data either use fgetc or use fread.
Line 31: This looks like you may be trying to recombine binary bytes into an integer. You have the logical wrong. You only ever modify a[i][j] based on its current value, however you never initialise the current value anywhere you need to set a[i][j] to 0 somewhere. You also use the value of a[i][j] as a multiplier of the value read which is not correct and pow(j,j) raise j to itself seems wrong did you mean pow(2,j) also pow uses type double which makes it unreliable in an integer operation. It is more standard when recombining an int to use the shift operators since they work on ints i.e. a[i][j] += ch << (j * 8);
Line 33: You try to write the text value to file but using fputc you truncate the int a[i][j]. Also at this point j is -1 and you are accessing the array outside it's boundaries, which is definitely undefined behaviour and probably a crash.
Line 36: You only close the files and call exit if a[i][j] is EOF. EOF should be the end condition for your loop at line 26. At the end of the program you always need to close your files and you should return a value from main.
PSEUDO CODE
Read a binary 4 byte integer from a file where it is stored in big endian format
-
REPEAT
-
result = 0;
-
-
FOR ix IS 0 TO 3
-
value = READ BYTE FROM FILE EXIT IF FAILED
-
-
result |= value << ((3 - ix) * 8)
-
ENDFOR
-
-
USE result
-
-
UNTIL EOF
-
Write a binary 4 byte integer to a file where it is stored in big endian format
-
REPEAT
-
result = GET NEXT INTEGER;
-
-
FOR ix IS 0 TO 3
-
value = (result >> ((3 - ix) * 8)) & 0xFF
-
-
WRITE BYTE value TO FILE EXIT IF FAILED
-
ENDFOR
-
-
USE result
-
-
UNTIL NO MORE INTEGERS
-