"Hello World!" in C in hackerrank solution

    
#include 

int main() {
    char str[100];
    fgets(str, sizeof(str), stdin);
    printf("Hello, World!\n");
    printf("%s", str);
    return 0;
}

        

In this solution, we use the printf function from the standard input/output library (stdio.h) to print the string "Hello World!" to the console. The \n represents a newline character, which adds a line break after printing the message.

Copy the program and paste in hackerrank editor.first remove default code.