diff options
Diffstat (limited to 'C_Programming_for_the_Absolute_Beginner/Chapter2.ipynb')
-rwxr-xr-x | C_Programming_for_the_Absolute_Beginner/Chapter2.ipynb | 239 |
1 files changed, 0 insertions, 239 deletions
diff --git a/C_Programming_for_the_Absolute_Beginner/Chapter2.ipynb b/C_Programming_for_the_Absolute_Beginner/Chapter2.ipynb deleted file mode 100755 index 2f3c44af..00000000 --- a/C_Programming_for_the_Absolute_Beginner/Chapter2.ipynb +++ /dev/null @@ -1,239 +0,0 @@ -{
- "metadata": {
- "name": "",
- "signature": "sha256:622f2c579033e8c66b476e16d61ce8bfa6745f6b87c5905b2064108fa5218b3c"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 2 PRIMARY DATA TYPES"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.1, Page No. 32"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "x=-4443\n",
- "y=554.21\n",
- "c='M'\n",
- "\n",
- "print \"The value of integer variable x is\" , x\n",
- "print \"The value of float variable y is \" , y\n",
- "print \"The value of character variable c is \" , c"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The value of integer variable x is -4443\n",
- "The value of float variable y is 554.21\n",
- "The value of character variable c is M\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.2, Page No. 36"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "x = 20\n",
- "PI = 3.14\n",
- "print \"Constant values are \",x ,\" and \", round(PI,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Constant values are 20 and 3.14\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.3, Page No. 42"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "print \"\\t Adder Program, by Michael Vine\"\n",
- "iOperand1=int(raw_input(\"Enter First Operand: \"))\n",
- "iOperand2=int(raw_input(\"Enter Second Operand: \"))\n",
- "print \"The final result is \", iOperand1+iOperand2"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\t Adder Program, by Michael Vine\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter First Operand: 5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter Second Operand: 7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The final result is 12\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.4, Page No. 44"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "print \"\\t Adder Program, by Michael Vine\"\n",
- "iOperand1=int(raw_input(\"Enter First Operand: \"))\n",
- "iOperand2=int(raw_input(\"Enter Second Operand: \"))\n",
- "iResult=iOperand1+iOperand2\n",
- "print \"The result is \", iResult"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\t Adder Program, by Michael Vine\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter First Operand: 5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter Second Operand: 7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The result is 12\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.5, Page No. 46"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "fRevenue=float(raw_input(\"Enter total revenue: \"))\n",
- "fCost=float(raw_input(\"Enter total cost: \"))\n",
- "print \"Your total profit is \", round(fRevenue-fCost,3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter total revenue: 4000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter total cost: 750\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Your total profit is 3250.0\n"
- ]
- }
- ],
- "prompt_number": 3
- }
- ],
- "metadata": {}
- }
- ]
-}
\ No newline at end of file |