printf - Why won't a fraction print in an array that holds doubles -


जब मैं इस कोड का उपयोग करता हूँ:

  int main (शून्य) {डबल सरणी [1 ] [1]; सरणी [0] [0] 3/10 =; printf ( "% वामो", सरणी [0] [0]); }   

और मुझे 0.30000 देने के बजाय मुझे एक 0.000000 क्यों मिलता है?

अभिव्यक्ति 3/10 का उपयोग करके गणना की जाती है पूर्णांक विभाजन क्योंकि दोनों ऑपेरांज पूर्णांक हैं इसके बजाय, 3.0 / 10.0 का उपयोग सुनिश्चित करें कि गणना को फ़्लोटिंग पॉइंट का उपयोग किया जाता है।

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -