summaryrefslogtreecommitdiff
path: root/Teach_Yourself_C_in_24_Hours/hour3.ipynb
blob: 95b6416bd9dfa0c1a99c3742bce36e23a06bf2f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
 "metadata": {
  "name": "",
  "signature": "sha256:ce290cf2bde2b380a50d312f15b1ca096cf17ef06fb76494e9775a2b07fbccc8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Hour 3: Learning the Structure of a C program"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1, Page No.48"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print \"Howdy, neighbour! This is my first C program\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Howdy, neighbour! This is my first C program\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2, Page No.49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def integer_add(x,y):\n",
      "    result = x+y\n",
      "    return result\n",
      "#This program has no output because the function is not called in this program"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3, Page No.50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def integer_add(x,y):\n",
      "    result = x+y\n",
      "    return result\n",
      "sum=integer_add(5,12)\n",
      "print \"The addition of 5 and 12 is \",sum"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The addition of 5 and 12 is  17\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}