- Jul 6, 2001
- 2,740
- 0
- 0
OK heres the Code
#include<stdio.h>
int main()
{
int i, j;
for ( i = 0; i <= 3; i++ )
{
for( j = 0; j <= 4; j++ )
{
if (( i + 1 == j ) || ( j + 1 == 4 ))
{
printf("+");
}
else
{
printf("o");
}
}
printf("\n");
}
return 0;
}
When i worked this out on paper here is my version of the output:
0+00+\n
00++0\n
000+0\n
0+00+\n
Am i correct?
When i compiled it, the program gave me:
0+0+0\n
00++0\n
000+0\n
000++\n
I don't know what i did wrong, my friend worked this out on paper and got the same result that i got.
Can anyone confirm the output?
#include<stdio.h>
int main()
{
int i, j;
for ( i = 0; i <= 3; i++ )
{
for( j = 0; j <= 4; j++ )
{
if (( i + 1 == j ) || ( j + 1 == 4 ))
{
printf("+");
}
else
{
printf("o");
}
}
printf("\n");
}
return 0;
}
When i worked this out on paper here is my version of the output:
0+00+\n
00++0\n
000+0\n
0+00+\n
Am i correct?
When i compiled it, the program gave me:
0+0+0\n
00++0\n
000+0\n
000++\n
I don't know what i did wrong, my friend worked this out on paper and got the same result that i got.
Can anyone confirm the output?