diff options
Diffstat (limited to 'Fundamental_of_Computing_and_Programming_in_C/Chapter09.ipynb')
-rwxr-xr-x | Fundamental_of_Computing_and_Programming_in_C/Chapter09.ipynb | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/Fundamental_of_Computing_and_Programming_in_C/Chapter09.ipynb b/Fundamental_of_Computing_and_Programming_in_C/Chapter09.ipynb new file mode 100755 index 00000000..11735b92 --- /dev/null +++ b/Fundamental_of_Computing_and_Programming_in_C/Chapter09.ipynb @@ -0,0 +1,109 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1a0147da7a94fc5ebe7c66bbf21a563cb0bee33c1452a7bcfcbc21f5395d7aab" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 09 : Parameter Passing Methods" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example: 1, Page No.: 5.63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Call By Value\n", + "\n", + "def cube(x):\n", + " x=x*x*x\n", + " return(x)\n", + "\n", + "n=5\n", + "print \"Cube of %d is\"%n,cube(n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cube of 5 is 125\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example: 2, Page No.:5.64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Call by reference\n", + "\n", + "def interchange(a,b):\n", + " t=0\n", + " t=a\n", + " a=b\n", + " b=t\n", + " return b,a\n", + "\n", + " \n", + "i=5\n", + "j=10\n", + "print \"i and j values before interchange:\", i, j\n", + "\n", + "i=10\n", + "j=5\n", + "interchange(i,j)\n", + "\n", + "#Result\n", + "print \"i and j values after interchange:\",i,j\n", + "\n", + "print \"i and j avalues after interchange in the function : %d %d \\n\"%interchange(i,j)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i and j values before interchange: 5 10\n", + "i and j values after interchange: 10 5\n", + "i and j avalues after interchange in the function : 10 5 \n", + "\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |