diff options
author | Hardik Ghaghada | 2014-06-20 15:52:25 +0530 |
---|---|---|
committer | Hardik Ghaghada | 2014-06-20 15:52:25 +0530 |
commit | e1e59ca3a50d9f93e8b7bc0693b8081d5db77771 (patch) | |
tree | f54eab21dd3d725d64a495fcd47c00d37abed004 /Practical_C_Programming/Chapter_16_1.ipynb | |
parent | a78126bbe4443e9526a64df9d8245c4af8843044 (diff) | |
parent | 83c1bfceb1b681b4bb7253b47491be2d8b2014a1 (diff) | |
download | Python-Textbook-Companions-e1e59ca3a50d9f93e8b7bc0693b8081d5db77771.tar.gz Python-Textbook-Companions-e1e59ca3a50d9f93e8b7bc0693b8081d5db77771.tar.bz2 Python-Textbook-Companions-e1e59ca3a50d9f93e8b7bc0693b8081d5db77771.zip |
Merge pull request #1 from debashisdeb/master
removing problem statements from all the chapters to avoid copyright violations
Diffstat (limited to 'Practical_C_Programming/Chapter_16_1.ipynb')
-rw-r--r-- | Practical_C_Programming/Chapter_16_1.ipynb | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/Practical_C_Programming/Chapter_16_1.ipynb b/Practical_C_Programming/Chapter_16_1.ipynb index d1d60ff9..505718fd 100644 --- a/Practical_C_Programming/Chapter_16_1.ipynb +++ b/Practical_C_Programming/Chapter_16_1.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "Chapter 16" + "name": "", + "signature": "sha256:8846db95d13f18ddbaba03cb28aa141be8268e397ec14735e02a0f66209b0b25" }, "nbformat": 3, "nbformat_minor": 0, @@ -11,25 +12,57 @@ "cell_type": "heading", "level": 1, "metadata": {}, - "source": "Chapter 16: Floating point" + "source": [ + "Chapter 16: Floating point" + ] }, { "cell_type": "heading", "level": 3, "metadata": {}, - "source": "Example 16.1, Page number: 322" + "source": [ + "Example 16.1, Page number: 322" + ] }, { "cell_type": "code", "collapsed": false, - "input": "# Example 16.1.py\n# To calculate the accuracy of calculations and storage\n\n\n# Variable declaration\nnumber1 = 1.0\nnumber2 = 1.0\ncounter = 0\n\n# Calculation and result\nwhile (number1 + number2 != number1) :\n counter += 1\n number2 = number2 / 10.0\n\nprint ('%2d digits accuracy in calculations\\n' % counter)\n\n\nnumber2 = 1.0\ncounter = 0\n\nresult = number1 + number2\ncounter += 1\nnumber2 = number2 / 10.0\n\nprint ('%2d digits accuracy in storage\\n' % counter)", + "input": [ + "\n", + "# Variable declaration\n", + "number1 = 1.0\n", + "number2 = 1.0\n", + "counter = 0\n", + "\n", + "# Calculation and result\n", + "while (number1 + number2 != number1) :\n", + " counter += 1\n", + " number2 = number2 / 10.0\n", + "\n", + "print ('%2d digits accuracy in calculations\\n' % counter)\n", + "\n", + "\n", + "number2 = 1.0\n", + "counter = 0\n", + "\n", + "result = number1 + number2\n", + "counter += 1\n", + "number2 = number2 / 10.0\n", + "\n", + "print ('%2d digits accuracy in storage\\n' % counter)" + ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", - "text": "16 digits accuracy in calculations\n\n 1 digits accuracy in storage\n\n" + "text": [ + "16 digits accuracy in calculations\n", + "\n", + " 1 digits accuracy in storage\n", + "\n" + ] } ], "prompt_number": 1 |