Program to read 9 elements and print them in 3 x 3 matrix form using c Language

Program to read 9 elements and print them in 3 x 3 matrix form using c Language


#include

main()

{

int a[9],c=0;

register int i;

clrscr();

printf("ENTER 9 ELEMENTS\n");

for (i=0;i<9;i++)

scanf("%d",&a[i]);

printf("THE ELEMENTS IN 3*3 MATRIX FORM IS\n");

for (i=0;i<9;i++)

{

printf("%2d",a[i]);

c++;

if (c%3==0)

printf("\n");

}

getch();

}



No comments:

Post a Comment