summaryrefslogtreecommitdiff
path: root/Programming_in_C/Chapter_03.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Programming_in_C/Chapter_03.ipynb')
-rw-r--r--Programming_in_C/Chapter_03.ipynb116
1 files changed, 96 insertions, 20 deletions
diff --git a/Programming_in_C/Chapter_03.ipynb b/Programming_in_C/Chapter_03.ipynb
index 0f1f4347..bbc7d9cf 100644
--- a/Programming_in_C/Chapter_03.ipynb
+++ b/Programming_in_C/Chapter_03.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter III"
+ "name": "",
+ "signature": "sha256:57f27b589000036417c51c927626e752909312f11d9fc5346eab037945b09afc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,35 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 3: Compiling and running your first program"
+ "source": [
+ "Chapter 3: Compiling and running your first program"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.1, Page number: 11"
+ "source": [
+ "Program 3.1, Page number: 11"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.1.py\n#first Python Program\n\n#Print Statement\nprint(\"Programming is Fun.\")",
+ "input": [
+ "\n",
+ "#Print Statement\n",
+ "print(\"Programming is Fun.\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Programming is Fun.\n"
+ "text": [
+ "Programming is Fun.\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +49,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.2, Page number: 14"
+ "source": [
+ "Program 3.2, Page number: 14"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.2.py\n#Writing Your First C Program(Version2)\n\n#Print statement\nprint(\"Programming is Fun.\")\nprint(\"And Programming in Python is even more fun\")",
+ "input": [
+ "\n",
+ "\n",
+ "#Print statement\n",
+ "print(\"Programming is Fun.\")\n",
+ "print(\"And Programming in Python is even more fun\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Programming is Fun.\nAnd Programming in Python is even more fun\n"
+ "text": [
+ "Programming is Fun.\n",
+ "And Programming in Python is even more fun\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +81,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.3, Page number: 14"
+ "source": [
+ "Program 3.3, Page number: 14"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.3.py\n#Displaying multiple Lines of output\n\n#Print statements using escape sequence\nprint(\"Testing...\\n..1\\n...2\\n....3\\n\")",
+ "input": [
+ "#3.3.py\n",
+ "#Displaying multiple Lines of output\n",
+ "\n",
+ "#Print statements using escape sequence\n",
+ "print(\"Testing...\\n..1\\n...2\\n....3\\n\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Testing...\n..1\n...2\n....3\n\n"
+ "text": [
+ "Testing...\n",
+ "..1\n",
+ "...2\n",
+ "....3\n",
+ "\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +116,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.4, Page number: 15"
+ "source": [
+ "Program 3.4, Page number: 15"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.4.py\n#Displaying Variables\n \nsum=50+25\nprint(\"The sum of 50 & 25 is: {0} \".format(sum))",
+ "input": [
+ " \n",
+ "sum=50+25\n",
+ "print(\"The sum of 50 & 25 is: {0} \".format(sum))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of 50 & 25 is: 75 \n"
+ "text": [
+ "The sum of 50 & 25 is: 75 \n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +145,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.5, Page number: 16"
+ "source": [
+ "Program 3.5, Page number: 16"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.5.py\n#Displayig multiple values\n\n#Variable declaration\nvalue1=50\nvalue2=25\n\n#Calculation\nsum=value1+value2\n\n#Result\nprint(\"The sum of {0} & {1} is: {2}\".format(value1,value2,sum))",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "value1=50\n",
+ "value2=25\n",
+ "\n",
+ "#Calculation\n",
+ "sum=value1+value2\n",
+ "\n",
+ "#Result\n",
+ "print(\"The sum of {0} & {1} is: {2}\".format(value1,value2,sum))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of 50 & 25 is: 75\n"
+ "text": [
+ "The sum of 50 & 25 is: 75\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +182,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.6, Page number: 17"
+ "source": [
+ "Program 3.6, Page number: 17"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.6.py\n#Using Comment in a program\n\n#'#(Hash/Pound)' is used to display a comment in python\n#This is a comment\n\n#Variable declarations\nvalue1=50\nvalue2=25\n\n#Calculation\nsum=value1+value2\n\n#Result\nprint(\"The sum of {0} & {1} is {2}\".format(value1,value2,sum))",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declarations\n",
+ "value1=50\n",
+ "value2=25\n",
+ "\n",
+ "#Calculation\n",
+ "sum=value1+value2\n",
+ "\n",
+ "#Result\n",
+ "print(\"The sum of {0} & {1} is {2}\".format(value1,value2,sum))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of 50 & 25 is 75\n"
+ "text": [
+ "The sum of 50 & 25 is 75\n"
+ ]
}
],
"prompt_number": 6