Please indent your code!!! It not only makes things more pleasant for people on here trying to help, but it would have lead you to your problem (assuming it's the same compile error I see):
Code:
temp.c(30): error C2143: syntax error : missing ')' before 'string'
temp.c(30): error C2143: syntax error : missing '{' before 'string'
temp.c(30): error C2059: syntax error : '<Unknown>'
temp.c(30): error C2059: syntax error : ')'
temp.c(33): error C2059: syntax error : 'return'
temp.c(34): error C2059: syntax error : '}'
Now, had you nicely indented your code.......
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
void main()
{
int num[4][4];
int i,j,sum;
printf("\nEnter any 16 numbers :");
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
scanf("%d",&num[i][j]);
}
}
printf("\n Your 16 entered no are as follows \n");
for(i=0;i<4;i++)
{
for(j=0;j<4;j++) {
printf("%d \t",num[i][j]);
}
printf("\n");
}
for(i=0;i<4;i++)
{
sum=0;
for(j=0;j<4;j++)
{
sum=sum+num[i][j];
}
printf("\nSum of row %d is : %d ",i+1,sum);
}
for(i=0;i<4;i++)
{
sum=0;
for(j=0;j<4;j++)
{
sum=sum+num[j][i];
}
printf("\nSum of coloumn %d is : %d",i+1,sum);
}
printf("\nSum of Diagonal 1 : %d ",num[0][0]+num[1][1]+num[2][2]+num[3][3]);
printf("\nSum of Diagonal 2 : %d ",num[0][3]+num[1][2]+num[2][1]+num[3][0]); getch();
}
system("pause");
return 0;
}
You can easily see that you have mismatched curly braces, so you have some statements outside of any functions.
Indentation is really important!!
Haven't tried to see if your program actually works yet, looks okay to me.
Should be int main(void), see:
FAQ > main() / void main() / int main() / int main(void) / int main(int argc, char *argv[]) - Cprogramming.com