Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Cognizant Coding Question- 2

One comment on “Cognizant Coding Question- 2”


  • Deepjyoti

    #include
    #include
    int path(int maze[3][3]);
    int main()
    {
    int i,j,maze[3][3], result=0;
    for(i=0;i<3;i++)
    {
    for(j=0;j<3;j++)
    scanf ("%d", &maze[i][j]);
    }
    printf("%d", path(maze));
    return 0;
    }

    int path(int m[3][3])
    {
    static int i;
    int j;
    for(i=0;i<3;i++)
    {
    for(j=0;j<3;j++)
    {
    if((m[i][j]==1))
    path(m[3][3]);
    if(m[i][j]==0)
    return 0;
    if(m[i][j]==9)
    return 1;
    }
    }
    }