Write a routine that prints out a 2-D array in spiral order!
Answer / gajender singh
#define n 4
int A[n][n]={{1,2,3,4},{5,6,7,8},{9,10,11,12},
{13,14,15,16}};
int min=0,max=n-1,i,j;
while(min<max)
{
for(i=min;i<=max;i++)
printf("%d,",A[min][i]);
for(i=min+1;i<=max;i++)
printf("%d,",A[i][max]);
for(i=max-1;i>=min;i--)
printf("%d,",A[max][i]);
for(i=max-1;i>min;i--)
printf("%d,",A[i][min]);
min++;
max--;
}
Is This Answer Correct ? | 17 Yes | 11 No |
Write a program to print “hello world” without using semicolon?
which of the following statements is incorrect a.typedef struct new{ int n1; char n2; } DATA; b.typedef struct { int n3; char *n4; }ICE; c.typedef union { int n5; float n6; } UDT; d.#typedef union { int n7; float n8; } TUDAT;
what is the size of an integer variable?
how is the examination pattern?
what is foreign key in c language?
write a C code To reverse a linked list
what is the difference between getch() and getche()?
Why do we use c for the speed of light?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
a value that does not change during program execution a) variabe b) argument c) parameter d) none
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
Please write the area of a RIGHT ANGLED TRIANGLE.