Here is what i have tried:
#include <conio.h>
#include <stdio.h>
// calculeaza produsul elementelor diagonalei secundare ale unei matrici
// 1 2 3
// 5 4 2
// 6 5 8 == 13
void main(){
int a[20][20], i, j, n, p;
printf("Dati numarul de linii si coloane a matricei:");
scanf("%d", &n);
for(i=1; i<=n; i++)
for(j=1; j<=n; j++){
printf("a["<<i<<","<<j<<"]=");
scanf(a[i][j]);
}
p=1;
for(i=1; i<=n; i++)
for(j=1; j<=n; j++)
if(i+j == n+1){
p=a[i][j];
}
printf("Produsul=%d", p);
getch ();
}
I get 3 errors though:
1.Illegal use of pointer, line 13.
2.Can not convert 'int' to 'const char *', line 14.
3.Type mismatch in parameter '_format' in call to 'scanf(const char *,...)'.
I can not figure this out, I did this in C++ but can not make it work in C.
Please check your printf() and scanf()'s.printf() can be use as
scanf() should be used as: