Input and Output | HackerRank
Learn to take in the input and print the output. Take three number as input and print their sum as output.
www.hackerrank.com
Goal
Read 3 numbers from stdin and print their sum to stdout
Solution
This challenge is to practice reading input from stdin(standard input stream) and printing out to stdout(standard output stream).
// Input and Output
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int a, b,c ;
int result = 0;
cin >> a >> b >> c;
result = a + b + c;
cout << result << endl;
return 0;
}
'software Engineering > (C++)HackerRank' 카테고리의 다른 글
[C++] HackerRank - Functions (0) | 2023.02.04 |
---|---|
[C++] HackerRank - For Loop (0) | 2023.01.24 |
[C++] HackerRank - Conditional Statements (0) | 2023.01.24 |
[C++] HackerRank - Basic Data Types (0) | 2023.01.22 |
[C++] HackerRank - "Say "Hello, World!" With C++" (0) | 2023.01.18 |