summaryrefslogtreecommitdiff
path: root/ANSI_C_Programming/chapter1.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'ANSI_C_Programming/chapter1.ipynb')
-rw-r--r--ANSI_C_Programming/chapter1.ipynb200
1 files changed, 200 insertions, 0 deletions
diff --git a/ANSI_C_Programming/chapter1.ipynb b/ANSI_C_Programming/chapter1.ipynb
new file mode 100644
index 00000000..d5485e0e
--- /dev/null
+++ b/ANSI_C_Programming/chapter1.ipynb
@@ -0,0 +1,200 @@
+{
+ "metadata": {
+ "name": "chapter1.ipynb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 1: GETTING STARTED"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Calculation of simple interest\n",
+ "#Author gekay Date:25/08/2009\n",
+ "p=1000\n",
+ "n=3\n",
+ "r=8.5\n",
+ "si=p*n*r/100 #formula for simple interest\n",
+ "print \"%f\\n\" % (si)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "255.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Calculation of simple interest\n",
+ "#Author gekay Date 25/07/2008\n",
+ "print \"Enter values of p,n,r\"\n",
+ "p=eval(raw_input())\n",
+ "n=eval(raw_input())\n",
+ "r=eval(raw_input())\n",
+ "si=p*n*r/100\n",
+ "print \"%f\\n\" % (si)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter values of p,n,r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "8.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "255.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example on page:18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Just for fun. Author.Bozo\n",
+ "print \"Enter a number\"\n",
+ "num=eval(raw_input()) #to take user input\n",
+ "print \"Now I am letting you on a secret...\\n\"\n",
+ "print \"You have just entered the number %d\\n\" % (num)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "30\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Now I am letting you on a secret...\n",
+ "\n",
+ "You have just entered the number 30\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#to find exponentiation of numbers\n",
+ "a=pow(3,2) #(3**2) will also do the same operation\n",
+ "print \"%d\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "9\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file