Knowee
Questions
Features
Study Tools

main( ){int i, j ;for ( i = 1 ; i <= 2 ; i++ ){for ( j = 1 ; j <= 2 ; j++ ){if ( i == j )continue ;printf ( “n%d %dn”, i, j ) ;}}}1 22 12 11 23 22 3Error

Question

main( ) {

int i, j ;
for ( i = 1 ; i <= 2 ; i++ ) {
for ( j = 1 ; j <= 2 ; j++ ) {
if ( i == j ) continue ;
printf ( "n%d %dn", i, j ) ;
}
}
}
1 22 12 11 23 22 3Error

🧐 Not the exact question you are looking for?Go ask a question

Solution

The code you've posted is written in C language. It's a simple program that uses nested for loops and an if condition to print out certain values of i and j. However, there seems to be a syntax error in your printf statement. The correct syntax for printf in C language is to use double quotes (" "), not the stylized quotes (“ ”).

Here's the corrected code:

#include<stdio.h>

main( ){
    int i, j;
    for ( i = 1 ; i <= 2 ; i++ ){
        for ( j = 1 ; j <= 2 ; j++ ){
            if ( i == j )
                continue ;
            printf ( "%d %d\n", i, j ) ;
        }
    }
}

This program will print the values of i and j when they are not equal. The 'continue' statement skips the rest of the current loop iteration and continues with the next iteration. So, when i is equal to j, the printf statement is skipped.

The output of this program will be:

1 2
2 1

This is because when i and j are both 1, the printf statement is skipped due to the 'continue' statement. The same happens when i and j are both 2. The other combinations (i=1, j=2 and i=2, j=1) are printed out.

This problem has been solved

Similar Questions

The output of the code will be ____. int i=5; printf(“%d %d %d”, i, i++, ++i); ans.

What is the output of the following piece of code?int i;i = 10;while (i < 20){ printf("%d", i % 2); i++;}

What is the output of the following code?int arr[] = {1, 2, 3, 4, 5};int i;for (i = 0; i < 5; i++)    arr[i] = arr[i] + 2;printf("%d\n", arr[3]);

What will be the output of the following C code?#include <stdio.h>int main() {    int i;    for (i = 0; i < 5; i++);    printf("%d\n", i);    return 0;}

The output of the code is ___. int fact=1; for (i=1; 4; i++) { fact=fact*i; printf(“%d”, fact); } ans. Infinite loop 6 120 24

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.