Input and output C++ HackerRank solution

• Updated June 2, 2022

Consuming an input in a program and showing it as output is one of the crucial things to get started in introductory programming. This tutorial will show you the Input and output C++ HackerRank solution and make sure you get started the right way.

Input and output C++ HackerRank solution

Problem statement

In this challenge, we practice reading input from stdin and printing output to stdout. In C++, you can read a single whitespace-separated token of input using…

You can check out the complete problem on Input and Output at HackerRank.

Also Read: Hello world problem solved Hackerrank

Solution

By using a Cin, we can take multiple inputs respectively and assign them to each variable. With Cout, we can return each variable in the same way, though in this case, we are returning the sum on the inputs.

#include <iostream>

using namespace std;

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    cout<<a+b+c;   
    return 0;
}
Sharing Is Caring:
Soumya Mondal

An aspiring BTech Electronics and Communication student, obsessed with Coding, Gadgets, Blogging, & Digital Marketing.

Leave a Comment