While loop

#include <stdio.h>

int main() {
    int i = 1;

    while (i <= 5) {
        printf("Value of i: %d\n", i);
        i++;
    }

    return 0;
}
  1. Include the standard input-output library.

  2. Define the main function.

  3. Declare and initialize an integer variable i with the value 1.

  4. Start a while loop with the condition i less than or equal to 5.

  5. Inside the loop, print the value of i using the printf function.

  6. Increment the value of i by 1 using the i++ increment operator.

  7. End the while loop.

  8. Return 0 to indicate successful execution of the program.