Home » C Programming » Loops » Question
  1. Which of the following statement are correct about the program given below?
    #include <stdio.h>
    int main ( )
    {
    char ch;
    while (ch = 0; ch <= 255; ch++)
    printf ("ASCII value %d Character %c\n", ch, ch);
    return 0;
    }
    1. The program goes in an infinite loop.
    2. The program prints all the ASCII values with its corresponding characters.
    3. Error: ch should be declared as an int.
    4. The program reports an error as while loop cannot take the form of a for loop.
Correct Option: D

The program reports an error as while loop cannot take the form of a for loop.



Your comments will be displayed only after manual approval.