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
|
3982 Discussions
|
Please Login in order to post a comment
i = 4 d = 4.0 s = 'HackerRank '
a = int(input()) b = float(input()) c = str(input()) print(i+a) print(d+b) print(s+c)
How do you solve this challenge? When I submit my code, it remains "unsolved" but it gave me full credit under the submissions tab.
If you plan to complete this in node here is a small tutorial: Typecasting We use parseInt() function to parse to integer and parsefloat to parse the double number. Number() is also another function you can use
Precision In JavaScript, the Number.prototype.toFixed() method is commonly used to control the precision of a number after the decimal point. This method formats a number using fixed-point notation and returns a string representation of the number with a specified number of digits after the decimal point.
c#
Console.Write((i+Convert.ToInt32(Console.ReadLine()))+"\n"+(d+Convert.ToDouble(Console.ReadLine())).ToString("F1")+"\n"+s+Console.ReadLine());