Wednesday, 22 March 2017

Hackerrank Solution For Day 0: Hello, World

Problem:- Write a Hackerrank Solution For Day 0: Hello, World or Hacker Rank Solution Program In C++ For " Day 0: Hello, World." or Hackerrank solution for 30 Days of Code Challenges. 

Hackerrank Solution For Day 0: Hello, World

Logic:- This is a very simple program in any programming language or we can say that this is a first program that we execute the first time in the learning time of any language like C language, C++ language, Java language and Python language. So basically in this program, we have to print a string Hello, World. Here we will choose C++ Domain for coding and find all solution of 30 Days Challenges Series. So in C++ " cout<< " is used for print anything in the terminal so we will put the string " Hello, World. " in double quotes, Below is an explanation of program step by step.

Explanation:-

string input_string;

input_string is a variable which stores the string " Hello, World. " in string format. We know that we can store string or character also, there is a no limitation. A string may contain many characters there is no limitation. 

getline(cin, input_string)

getline is used for store multiple strings with included space and next-line. getline reads line by line and store the string in the variable and cin is used for storing anything in C++.

cout << "Hello, World." << endl;

as I already mention that cout is stream output and printf(" ") in C is a function. So for printing any string and number we just put the string between double quotes.


Below is the Solution of Hackerrank 30 challenges series or day 0 solution in Hackerrank. You can copy The Color Code and paste it into Hackerrank Editor or you can copy the full code and paste into Hackerrank Editor. You can direct click below link and it will redirect to problem page you have to just log in and run and test the code.


Submit Your Solution Here:- Click Here

Solution:-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    // Declare a variable named 'input_string' to hold our input.
    string input_string; 
    
    // Read a full line of input from stdin (cin) and save it to our variable, input_string.
    getline(cin, input_string); 
    
    // Print a string literal saying "Hello, World." to stdout using cout.
    cout << "Hello, World." << endl;

    // TODO: Write a line of code here that prints the contents of input_string to stdout.
    cout<<input_string;
    return 0;
}

Output:-


Hackerrank Solution For Day 0: Hello, World

You May Also Like:-












Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment