Hello There, Guest! RegisterLogin with Facebook
Login with Facebook

New Anna University Nov / Dec 2016 Examination Important Questions
New Anna University (UG / PG) Nov/Dec 2016 and Jan 2017 Theory , Practical Exam Timetable
>>> Anna University Sixth Semester Question Bank Collection (R2013) ECE,MECH,CSE,IT,EEE,CIVIL,EIE
>>> Anna University November/December 2015 Examination Question Papers
>>> Anna University Study Materials for all Departments
>>> Anna University Question Papers : April May June 2015 Question Papers | Nov Dec 2014 and Jan 2015 Question Papers

Register or Login to Submit Study Materials , Shoutbox and also to access Many Features !!

Vidyarthiplus Shop :: Handwritten Premium Lecture Notes
Share your Study Materials with us
Share your Study Materials with us : Click Here

what is the Output of the programme,genius will Answer?
#1


# include
void main(){
int n, i, j, c, a[9][9] ;
printf("Enter the size of the magic square : ") ;
scanf("%d", &n) ;
if (n % 2 == 0){
printf("\nMagic square is not possible") ;
goto end ;
}
printf("\nThe magic square for%d x %d is :\n\n", n, n) ;
j = (n + 1) / 2 ;
i = 1 ;
for(c = 1 ; c <= n * n ; c++)
{
a[j] = c ;
if(c % n == 0)
{
i = (i + 1);
goto loop ;
}
if(i == 1)
i = n ;
else
i = i - 1 ;
if(j == n)
j = 1;
else
j = j + 1 ;
loop : ;
}
for (i = 1 ; i <= n ; i++)
{
for (j = 1 ; j <= n ; j++)
{
printf("%d\t", a[i][j]) ;
}
printf("\n\n") ;
}
end : ;
getchar() ;
}

write ur output#
[/i]

"It is very easy to defeat someone, But It's very hard to win someone"                                                                                        - Dr.A.P.J.Abdul Kalam


Reply

Subscribe


Recommend on Google