C colourful output

Language: C - Colorful Output

To achieve colorful output in C, you can use escape sequences to change the text color. Here's an example of how you can do this:

#include <stdio.h>

int main() {
   printf("\033[1;31mThis is red text\033[0m\n");
   printf("\033[1;32mThis is green text\033[0m\n");
   printf("\033[1;33mThis is yellow text\033[0m\n");
   return 0;
}

In this example, \033[1;31m changes the text color to red, \033[1;32m changes it to green, and \033[1;33m changes it to yellow. After the text, \033[0m is used to reset the color to the default. When you run this program, you'll see the text in different colors.

[[SOURCE #1]]