Code Competitions

Coding competition

Monday, 13 May 2013

Program to make latin square

#include<stdio.h>
#include<conio.h>
void main()
{
    int i,j,n,m,k;
    clrscr();
    printf("enter the value of n ");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        k=i;
        for(j=1;j<=n;j++)
        {
            printf("%-5d",k);
            if(k==n)
            {
                k=0;
            }
            k++;
        }
        printf("\n");
    }
    getch();
}

No comments:

Post a Comment