colourful text in c

To display colorful text in C, you can use escape sequences with the printf() function. Escape sequences are special combinations of characters that represent non-printable characters or formatting instructions. To display colorful text, you can use escape sequences for different colors.

Here's an example of how to display colorful text in C:

#include <stdio.h>

int main() {
    printf("\033[0;31m"); // set text color to red
    printf("This is red text.\n");
    printf("\033[0m"); // reset text color to default

    printf("\033[0;32m"); // set text color to green
    printf("This is green text.\n");
    printf("\033[0m"); // reset text color to default

    printf("\033[0;34m"); // set text color to blue
    printf("This is blue text.\n");
    printf("\033[0m"); // reset text color to default

    return 0;
}

In this example, the escape sequence \033[0;31m sets the text color to red, \033[0;32m sets the text color to green, and \033[0;34m sets the text color to blue. The escape sequence \033[0m resets the text color to the default.

Make sure your terminal supports ANSI escape sequences to see the colored text properly.