[algogeeks] what is the problem

2011-08-08 Thread Arshad Alam
/*

Given an array p[5], write a function to shift it circularly left by two
positions.Thus, if p[0] = 15, p[1]= 30, p[2] = 28, p[3]= 19 and p[4] = 61
then after the shift p[0] = 28, p[1] = 19,
p[2] = 61, p[3] = 15 and p[4] = 30. Call this function for a (4 x 5 ) matrix
and get its rows left shifted.

*/

#includestdio.h
#includeconio.h
void main()
{
clrscr();
int m,n,i,p[4],*flag;
int array[4][5]={
4,2,6,3,8,
1,2,8,3,9,
5,2,0,6,7,
1,0,2,5,6
};
int* twoshift(int *);
for(m=0;m20;m=m+5)
{
flag=twoshift(array[m][0]);
for(i=0;i5;i++)
printf(%d ,*(flag+i));
printf(\n);
}
getch();
}

int* twoshift(int *q)
{
int j,temp,i;
for(j=0;j2;j++)
{
temp=*(q+4);
printf(++%d ,*q);
  *(q+i+1)=*(q+i);
*q=temp;
}
return q;
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] what is the problem

2011-08-07 Thread Arshad Alam
/*

Given an array p[5], write a function to shift it circularly left by two
positions.Thus, if p[0] = 15, p[1]= 30, p[2] = 28, p[3]= 19 and p[4] = 61
then after the shift p[0] = 28, p[1] = 19,
p[2] = 61, p[3] = 15 and p[4] = 30. Call this function for a (4 x 5 ) matrix
and get its rows left shifted.

*/

#includestdio.h
#includeconio.h
void main()
{
clrscr();
int m,n,i,p[4],*flag;
int array[4][5]={
4,2,6,3,8,
1,2,8,3,9,
5,2,0,6,7,
1,0,2,5,6
};
int* twoshift(int *);
for(m=0;m20;m=m+5)
{
flag=twoshift(array[m][0]);
for(i=0;i5;i++)
printf(%d ,*(flag+i));
printf(\n);
}
getch();
}

int* twoshift(int *q)
{
int j,temp,i;
for(j=0;j2;j++)
{
temp=*(q+4);
printf(++%d ,*q);
  *(q+i+1)=*(q+i);
*q=temp;
}
return q;
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.