From 92cca121f959c6616e3da431c1e2d23c4fa5e886 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 7 Apr 2015 15:58:05 +0530 Subject: added books --- .../Chapter01.ipynb | 578 +++++++++++++++++++++ 1 file changed, 578 insertions(+) create mode 100755 Fundamental_of_Computing_and_Programming_in_C/Chapter01.ipynb (limited to 'Fundamental_of_Computing_and_Programming_in_C/Chapter01.ipynb') diff --git a/Fundamental_of_Computing_and_Programming_in_C/Chapter01.ipynb b/Fundamental_of_Computing_and_Programming_in_C/Chapter01.ipynb new file mode 100755 index 00000000..8e50e4de --- /dev/null +++ b/Fundamental_of_Computing_and_Programming_in_C/Chapter01.ipynb @@ -0,0 +1,578 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e61d5eac9962a1b27acd93d08c5b466532db593eb946c997e161cd14ea1acee1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 01 : Operators and Expressions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1: Page No.:4.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Usage of Arithmetic operators\n", + "\n", + "#Variable declaration\n", + "i=10\n", + "j=20\n", + "\n", + "#the sum value of variables i and j stores in k variable \n", + "k=i+j\n", + "\n", + "#Result\n", + "print \"Value of k is %d\"%(k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of k is 30\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2: Page No.:4.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Demonstrations on arithmetic operators\n", + "\n", + "#User Input\n", + "\n", + "a,b,c,d=input(\"Enter values of a, b, c, d: \")\n", + "\n", + "#Calculation\n", + "a+=(b*c)+d\n", + "\n", + "#Result\n", + "print \"Value of a = %d \"%(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter values of a, b, c, d ,e: 12,90,56,43\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a = 5095 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3: Page No.:4.36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Find out all arithmetic operation on two given values\n", + "\n", + "#Variable Declaration\n", + "sum=sub=mul=rem=0\n", + "div=0.0\n", + "a=0\n", + "#User Input\n", + "b,c,d=input(\"Enter the values of b, c, d: \")\n", + "\n", + "sum = b + c\n", + "sub = b - c\n", + "mul = b * c\n", + "div = b/c\n", + "rem = b % d\n", + "\n", + "print \"Sum = %d, Sub = %d, Mul = %d, Div = %f\"%(sum,sub,mul,div)\n", + "print \"Remainder of division of b & d is %d\"%(rem)\n", + "print \"a=%d\"%(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the values of b, c, d: 2,6,45\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum = 8, Sub = -4, Mul = 12, Div = 0.000000\n", + "Remainder of division of b & d is 2\n", + "a=0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4: Page No.: 4.38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Program to use various relational operators\n", + "\n", + "#!=,==,>=,<= are assignment operator\n", + "\n", + "print \"Condition : Return values\"\n", + "print \" 5!=5 : %5d\"%(5!=5) \n", + "print \" 5==5 : %5d\"%(5==5)\n", + "print \" 5>=5 : %5d\"%(5>=5)\n", + "print \" 5<=5 : %5d\"%(5<=50)\n", + "print \" 5!=3 : %5d\"%(5!=3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Condition : Return values\n", + " 5!=5 : 0\n", + " 5==5 : 1\n", + " 5>=5 : 1\n", + " 5<=5 : 1\n", + " 5!=3 : 1\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5: Page No.:4.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Demonstrate of logical operator\n", + "\n", + "#Variable Declaration\n", + "c1=c2=c3=0\n", + "\n", + "#USer Input\n", + "c1,c2,c3=input(\"Enter Values of C1, C2 and C3: \")\n", + "print \"\\n\"\n", + "\n", + "if (c1