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
|
3980 Discussions
|
Please Login in order to post a comment
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());
nextLine read leftovers also so after gving input of double we press enter nextLine reads it and returns empty so we need to add 1 more nextLine so that it can read the line we typed after pressing enter ( our input string ).
so we write it like: scan.nextLine(); // to clear buffer String str = scan.nextLine();
//in c++