Hello World Solution in C Programming

This Page Contains the Solution in C Programming Language for the Day 0 : Hello World , Code Challange of the HackerRank 30 Days of Code.

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {
    // Declare a variable named 'input_string' to hold our input.
    char input_string[105]; 
    
    // Read a full line of input from stdin and save it to our variable, input_string.
    scanf("%[^\n]", input_string); 
    
    // Print a string literal saying "Hello, World." to stdout using printf.
    printf("Hello, World.\n");
    
    // TODO: Write a line of code here that prints the contents of input_string to stdout.
    printf("%s",input_string);
    return 0;
}

Last updated

Was this helpful?