Completely Solved C, C++ Programs Assignment.




C Program to read ‘n’ number and print them in matrix terms in all orders

Filed Under:

Problem 54. C Program to read ‘n’ number and print them in matrix terms in all orders.
#include<stdio.h>
#include<conio.h>
main( )
{
int i,n,c,p,q,r,k,a[20];
clrscr();
printf(“enter the array size”);
scanf(”%d”,&n);
printf(“enter the elements”);
for(i=1;i<=n;i++)
scanf(“%d”,&a[i]);
i=1;
while(i<=n)
{
if(n%i==0)
{
r=i;c=n/i;
k=1;
for(p=1;p<=r;p++)
{
for(q=1;q<=c;q++)
printf(“%d”,a[k++])
printf(“n”);
}
i++;
getch( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments