The best VPN 2024

The Best VPS 2024

The Best C# Book

C Hackerrank code produces correct results on Data Types challenge in 30 days of code but says Im wrong

Humans are gone – what can I harvest from their cities 30M years later?

Recently I have tried to solve Day 1 Data types lesson for the 30 days of Code challenge in hackerrank and Ive run into a strange road block.The compiler keeps saying that my output is the wrong answer, but I print out the exact same integer double and string.the only thing thats different is that I dont have a decimal point on my double,which doesnt make sense because The only thing Ive done is read from the input,convert the input from a string to a double and then add the two doubles together

You can use.ToString()with an overload to format your result:

How do I convince my students that my grading really will be strict but fair when the university has an official grading policy?

Also thanks, It worked, but why did my decimal point go away? I dont want to mark this question as answered, because I really need to know this and because i dont think i should make a separate post about it.

This site uses cookies to deliver our services and to show you relevant ads and job listings. By using our site, you acknowledge that you have read and understand ourCookie PolicyPrivacy Policy, and ourTerms of Service. Your use of Stack Overflows Products and Services, including the Stack Overflow Network, is subject to these policies and terms.

so the 0 represents a default placeholder, then what does the do?

How can PlotLegends be added to Show

Measurement of total AC resistance (including radiation resistance) of a coil using LCR meter

Learn more about hiring developers or posting ads with us

How can I fix Broadcom driver Wifi with 4.15.0-24 kernel on Ubuntu 16.04

How to draw 3D scatter plot with sizes of points reflecting value?

the0represents a default placeholder, if there is no decimal point it will add0. else it will show the actual value.

What is a difference if I render video on high end processor or low end processor?

Discuss the workings and policies of this site

Can I eat myself into a black hole?

How advanced can a civilization get without zero?

represents any number preceding the.

How to talk to a teen daughter about her weight

How do I protest my childs suspension without poisoning the well?

The general (G) format specifier converts a number to the more compact of either fixed-point or scientific notation, depending on the type of the number and whether a precision specifier is present.Source

using System; using llections.Generic; using System.IO; class Solution static void Main(String[] args) int i = 4; double d = 4.0; string s = HackerRank ; //this is the start of my code,the top part is preset by hackerrank int a=Convert.ToInt32(Console.ReadLine()); double x = Convert.ToDouble(Console.ReadLine()); string l = Console.ReadLine(); Console.WriteLine(a+i); Console.WriteLine(d+x); Console.WriteLine(s+l); Console.ReadLine();

site design / logo 2018 Stack Exchange Inc; user contributions licensed undercc by-sa 3.0withattribution required.rev2018.7.5.30950

Can you guys help? This is my C code by the way.

How do I encourage Drow players to not make Drizzt clones?

Which city is shown in the film A trip to Wiesbaden?

Sign uporlog into customize your list.

as you can see my .0 is missing for my double, any help?

I (independently) solved a fellow students research problem. I want to publish it. What should I do?

According to the documentation above, if you were to change your data type todecimalinstead ofdoublethe.0should be preserved.

Is it well-defined to hold a misaligned pointer, as long as you dont ever dereference it?

Weaponry made from extreme light-weight steel: swords and daggers

method, you can find all the options via MSDN

In Magic: The Gathering, can I include a card in my deck that I cant play based on my land setup?

Learn more about Stack Overflow the company

Detailed answers to any questions you might have

Thanks for this, by the way, what is that .0 feature called? is it a special type of string formatting and/or placeholder? and is it exclusive to the .ToString() method?

By clicking Post Your Answer, you acknowledge that you have read our updatedterms of serviceprivacy policyandcookie policy, and that your continued use of the website is subject to these policies.

Join Stack Overflowto learn, share knowledge, and build your career.

Start here for a quick overview of the site

Why does it strip the.0in your case: according to MSDN,Console.WriteLine(double)represents the output as astringusing the defaultToString(G)overload:

here is there input they want me to use that I am using:

How much range can I get with two separate cassettes without changing chain length?

The text representation of value is produced by calling the Double.ToString method.Source

Which direction of slightly tilting the Earth will be most destructive?

Points of a dense set are not limit points

Did Jon Snow lose only two brothers as well?

Leave a Comment