Friday, January 20, 2012

C program for magic matrix

c program for magic matrix
magic matrix

#include<stdio.h>
#include<conio.h>
void main(){

int arr[3][3];
int i,j,sum1,sum2,sum3;
clrscr();
for(i=0;i<3;i++){
 for(j=0;j<3;j++){
 printf("Enter no");
 scanf("%d",&arr[i][j]);
 }
}
sum1=arr[0][0]+arr[0][1]+arr[0][2];
sum2=arr[0][0]+arr[1][0]+arr[2][0];
sum3=arr[0][0]+arr[1][1]+arr[2][2];
if(sum1==sum2 && sum2==sum3){
printf("Majic Matrics");
}
else{
printf("Not Majic Matrics");
}
getch();
}