# Thread: Answer This? what would be output?

1. ## Answer This? what would be output?

hello friend pls tel the output of this pro and als describe how?

#define ROWS 3
#define COLUMNS 4
int z[ROWS][COLUMNS]={1,2,3,4,5,6,7,8,9,10,11,12}

main()
{
int a,b,c;
for(a=0;a<ROWS;++a)
{
c=999;
for(b=0;b<COLUMNS;++b)
if(z[a][b]<c)
{
c=z[a][b];
}
printf("%d",c);
}
}

2. ## Re: Answer This? what would be output?

fhjoshngchkjmpgknm;,mn;fmgnp;lfm,ln,[;lgh,jnfnl,fl

3. ## Re: Answer This? what would be output?

1111111111111111111111111111111111111111111

4. ## Re: Answer This? what would be output?

Originally Posted by amar1_001
hello friend pls tel the output of this pro and als describe how?

#define ROWS 3
#define COLUMNS 4
int z[ROWS][COLUMNS]={1,2,3,4,5,6,7,8,9,10,11,12}

main()
{
int a,b,c;
for(a=0;a<ROWS;++a)
{
c=999;
for(b=0;b<COLUMNS;++b)
if(z[a][b]<c)
{
c=z[a][b];
}
printf("%d",c);
}
}
123 i s the answer

5. ## answer to thread problem

Originally Posted by amar1_001
hello friend pls tel the output of this pro and als describe how?

#define ROWS 3
#define COLUMNS 4
int z[ROWS][COLUMNS]={1,2,3,4,5,6,7,8,9,10,11,12}

main()
{
int a,b,c;
for(a=0;a<ROWS;++a)
{
c=999;
for(b=0;b<COLUMNS;++b)
if(z[a][b]<c)
{
c=z[a][b];
}
printf("%d",c);
}
}
ans:1 5 9 is the correct answer

6. ## Re: Answer This? what would be output?

Originally Posted by amar1_001
hello friend pls tel the output of this pro and als describe how?

#define ROWS 3
#define COLUMNS 4
int z[ROWS][COLUMNS]={1,2,3,4,5,6,7,8,9,10,11,12}

main()
{
int a,b,c;
for(a=0;a<ROWS;++a)
{
c=999;
for(b=0;b<COLUMNS;++b)
if(z[a][b]<c)
{
c=z[a][b];
}
printf("%d",c);
}
}
press f7 for compilation you know the reason for printing

7. ## Re: Answer This? what would be output?

hi ,
this is maddy

the o/p of given prg is 1.
description: clearly defins the value of rows =3,colomn=4
hence the matrix z has the dimension Z[3][4]
after initialization the matrix is 1 2 3 4
5 6 7 8
9 10 11 12
now in first for loop a=1,c=999,second for loop b=1
so z[1][1]=1 and after checking condition z[1][1]<999
is true then c= z[1][1]=1

8. ## Re: Answer This? what would be output?

i cant understand give the program

9. ## Re: answer to thread problem

Originally Posted by manish_tech
ans:1 5 9 is the correct answer
u r right this is the correct answer

10. ## Re: Answer This? what would be output?

The answer is 1 since the first element of the matrix is 1.

11. ## Re: Answer This? what would be output?

123 is the answer

12. ## Re: Answer This? what would be output?

1 5 9 is the output.
z={1,2,3,4,
5,6,7,8,
9,10,11,12}
in the first row 1 is the smallest and in the second row 5 is the smallest and in the third row 9 is the smallest.
according to your program c will always hold the smallest value in all the rows therefore 159 is the output

13. ## Re: Answer This? what would be output?

the answer is 1 , 5 , 9

nice question

14. ## Re: Answer This? what would be output?

The answer is 1,3,9.

Array is of z[3][4] = { 1 2 3 4
5 6 7 8
9 10 11 12
};
First Row
----------

first iteration - z[0][0] < c
1 < 999

c=1
Next Iteration - z[0][1] < 1 False so c values remains same ie c=1
1 < 1
Next iteration - z[0][2] < 1 False so c values remains same ie c=1

Next Iteration - z[0][3] < 1 False so c values remains same ie c=1

So least value element is taken from first row.

Similarly for next two rows.

hence the output would be 1,5,9.

15.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
###### About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.