We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 1: Data Types
Day 1: Data Types
Sort by
recency
|
3934 Discussions
|
Please Login in order to post a comment
The hardest part about this question in C++ was that the input variables are not clear.
Based on the instructions, I interpreted it as: - outputRequest1: input int + input double; - outputRequest2: input double + input double; - outputRequest3: "HackerRank " + getline(input string); But you acutally need to manually add numbers + the inputs and eat whitespace for the string.
i need help with the c++ my float will not work and my string only returns one word. i even tried using getline(cin ,str) but it just failed entirely i have done this in c++14 and c++20 someone please
JAVA Solution.
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
python3 code
Read input valuse
int_input = int(input().strip()) double_input = float(input().strip()) string_input = input().strip()
Perfom the required operations
int_sum = i + int_input** double_sum = d + double_input concatenated_string = s + string_input
print the results print(int_sum) print(f"{double_sum:.1f}") print(concatenated_string)
Python Solution...
i = 4 d = 4.0 s = 'HackerRank '
integer = int(input()) double = float(input()) string = str(input(""))
print(i + integer)
print(d + double)
print(s + string)