Home » C Programming » Loops » Question
  1. Which of the following is the correct output for the program given below?

    #include <studio.h>
    int main ( )
    {
    char j = 1;
    while (j <= 255)
    {
    printf("%d",j );
    j = j + 1;
    }
    printf ( "\n");
    return 0;
    }
    1. 1 2 3 ..... 127
    2. 1 2 3 ... 255
    3. 1 2 3 ..... 254 255 0 1 2 3 .. 254 255 ... infinite times
    4. 1 2 3 .... 127 128 0 1 2 3 .. 127 128 .. infinite times
    5. 1 2 3 .. 127 -128 -127 -126 .. -2 -1 0 1 2 .. 127 -128 -127 .. infinite times
Correct Option: E

1 2 3 .. 127 -128 -127 -126 .. -2 -1 0 1 2 .. 127 -128 -127 .. infinite times



Your comments will be displayed only after manual approval.