<\/span><\/h2>\n\n\n\nTo complete this challenge, you must save a line of input from stdin to a variable, print Hello, World.<\/code> on a single line, and finally print the value of your variable on a second line.<\/p>\n\n\n\nYou’ve got this!<\/p>\n\n\n\n
Note:<\/strong> The instructions are Java-based, but we support submissions in many popular languages. You can switch languages using the drop-down menu above your editor, and the inputString<\/em><\/strong> variable may be written differently depending on the best-practice conventions of your submission language.<\/p>\n\n\n\n<\/span>Input Format<\/strong><\/span><\/h2>\n\n\n\nA single line of text denoting inputString <\/em><\/strong>(the variable whose contents must be printed).<\/p>\n\n\n\n<\/span>Output Format<\/strong><\/span><\/h2>\n\n\n\nPrint Hello, World.<\/code> on the first line, and the contents of inputString<\/em><\/strong> on the second line.<\/p>\n\n\n\nSample Input<\/strong><\/p>\n\n\n\nWelcome to 30 Days of Code!<\/code><\/pre>\n\n\n\nSample Output<\/strong><\/p>\n\n\n\nHello, World. \nWelcome to 30 Days of Code!<\/code><\/pre>\n\n\n\nExplanation<\/strong><\/p>\n\n\n\nOn the first line, we print the string literal Hello, World.<\/code>. On the second line, we print the contents of the inputString<\/em><\/strong> variable which, for this sample case, happens to be Welcome to 30 Days of Code!<\/code>. If you do not print the variable’s contents to stdout, you will not pass the hidden test case.<\/em><\/p>\n\n\n\n<\/span>Solution – Day 0: Hello, World Solution<\/strong><\/span><\/h2>\n\n\n\n<\/span>C<\/strong><\/span><\/h3>\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main() \n{\n \/* Declare a variable named 'input_string' to hold our input.*\/\n char input_string[105]; \n \n \/* Read a full line of input from stdin and save it to our variable, input_string.*\/\n scanf(\"%[^\\n]\", input_string); \n \n \/* Print a string literal saying \"Hello, World.\" to stdout using printf.*\/\n printf(\"Hello, World.\\n\");\n \n \/* TO DO: Write a line of code here that prints the contents of input_string to stdout.*\/\n \n \/* Solution starts from here *\/\n \n printf(\"%s\",input_string);\n \n \/* Solution ends here *\/\n return 0;\n}<\/pre>\n\n\n\n<\/span>C++<\/strong><\/span><\/h3>\n\n\n\n#include <cmath>\n#include <cstdio>\n#include <vector>\n#include <iostream>\n#include <algorithm>\nusing namespace std;\nint main() {\n \/\/ Declare a variable named 'input_string' to hold our input.\n string input_string; \n\n \/\/ Read a full line of input from stdin (cin) and save it to our variable, input_string.\n getline(cin, input_string); \n\n \/\/ Print a string literal saying \"Hello, World.\" to stdout using cout.\n cout << \"Hello, World.\" << endl;\n\n \/\/ TODO: Write a line of code here that prints the contents of input_string to stdout.\n cout << input_string;\n\n return 0;\n}<\/pre>\n\n\n\n