check no. of elements printed in all inner for loop also

    for (int j=c;j<n-c-1 && cnt<m*n;j++) {printf("%d ",a[r][j]); cnt++;}
    for (int i=r;i<m-r-1 && cnt<m*n;i++) {printf("%d ",a[i][n-c-1]); cnt++}
    for (int j=n-c-1 && cnt<m*n;j>c;j--) {printf("%d ",a[m-r-1][j]); cnt++}
    for (int i=m-r-1 && cnt<m*n;i>r;i--) {printf("%d ",a[i][c]); cnt++}


On Fri, Jun 15, 2012 at 2:10 PM, Guneesh Paul Singh <gunees...@gmail.com>wrote:

> void spiral(int a[][],int m,int n)
> {
>         int c=1;
>
>
>  --
> 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.
>



-- 
Utsav Sharma,
NIT Allahabad

-- 
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.

Reply via email to