You are here:

C/Need for a solution

Advertisement


Question
respected sir,
i have a problem,i need the source cod of this latin square
 1 2 3 4
 2 3 4 1
 3 4 1 2
 4 1 2 3

Answer
Hi dear Anirban Paul !

Thanks for your question , Presenting you the solution for this problem !
#include<stdio.h>
void main()
{
  int i, j;

  for( i = 0 ; i < 4 ; i++)
  {
     for( j = 0 ; j <4 ; j++)
        printf("%d " , 1+(i+j)%4);
     printf("\n");
  }
}

O/P

1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3

Please revert me in case of issues !

Thanks and Regards !
Prince M. Premnath

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise


I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience

Research over 6+ Years

Organizations
CG-VAK Softwares and Exports Limited

Education/Credentials
Masters in Computer Applications

©2012 About.com, a part of The New York Times Company. All rights reserved.