#include <stdio.h>

int main() {
  int i = 0;

  // while loop
  while (i < 5) {
    printf("i = %d\n", i);
    i++;
  }

  // do-while loop
  do {
    printf("i = %d\n", i);
    i++;
  } while (i < 5);

  return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: