summaryrefslogtreecommitdiff
path: root/662/CH2
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /662/CH2
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '662/CH2')
-rwxr-xr-x662/CH2/EX2.1/ex2_1.JPGbin0 -> 9787 bytes
-rwxr-xr-x662/CH2/EX2.1/ex2_1.sce10
-rwxr-xr-x662/CH2/EX2.1/ex2_1_1.JPGbin0 -> 9868 bytes
-rwxr-xr-x662/CH2/EX2.25/ex2_25.JPGbin0 -> 21753 bytes
-rwxr-xr-x662/CH2/EX2.25/ex2_25.sce15
-rwxr-xr-x662/CH2/EX2.30/ex2_30.sce6
-rwxr-xr-x662/CH2/EX2.34/ex2_34.sce8
-rwxr-xr-x662/CH2/EX2.35/ex2_35.sce13
-rwxr-xr-x662/CH2/EX2.5/ex2_5.sce5
-rwxr-xr-x662/CH2/EX2.6/ex2_6.JPGbin0 -> 19684 bytes
-rwxr-xr-x662/CH2/EX2.6/ex2_6.sce10
11 files changed, 67 insertions, 0 deletions
diff --git a/662/CH2/EX2.1/ex2_1.JPG b/662/CH2/EX2.1/ex2_1.JPG
new file mode 100755
index 000000000..1bd9ab948
--- /dev/null
+++ b/662/CH2/EX2.1/ex2_1.JPG
Binary files differ
diff --git a/662/CH2/EX2.1/ex2_1.sce b/662/CH2/EX2.1/ex2_1.sce
new file mode 100755
index 000000000..0d339c2b3
--- /dev/null
+++ b/662/CH2/EX2.1/ex2_1.sce
@@ -0,0 +1,10 @@
+ //Example 2.1
+clc
+//Simple program to print "Welcome to c programming"
+printf("Welcome to c Programming\n");
+
+
+//If new line character is used.. then program output will change
+scanf("%c");
+clc
+printf("Welcome to \nc Programming\n");
diff --git a/662/CH2/EX2.1/ex2_1_1.JPG b/662/CH2/EX2.1/ex2_1_1.JPG
new file mode 100755
index 000000000..0ebde6af1
--- /dev/null
+++ b/662/CH2/EX2.1/ex2_1_1.JPG
Binary files differ
diff --git a/662/CH2/EX2.25/ex2_25.JPG b/662/CH2/EX2.25/ex2_25.JPG
new file mode 100755
index 000000000..a316ddd32
--- /dev/null
+++ b/662/CH2/EX2.25/ex2_25.JPG
Binary files differ
diff --git a/662/CH2/EX2.25/ex2_25.sce b/662/CH2/EX2.25/ex2_25.sce
new file mode 100755
index 000000000..eac12f1d8
--- /dev/null
+++ b/662/CH2/EX2.25/ex2_25.sce
@@ -0,0 +1,15 @@
+ //Example 2.25
+
+//one dimensional character array
+letter=['c','a','l','i','f','o','r','n','i','a'];
+
+//size displays the size of array as [start index. end index]
+[s,e]=size(letter);
+
+printf("Element Number Subscript Value Array Element Corresponding data Item");
+//in c the subscript start from 0 whereas in scilab from 1...
+for i = s: e
+ l=letter(i);
+ csub=i-1;
+ printf("\n%d \t\t %d \t\t letter[%d] \t\t %c", i , csub, csub, l );
+end
diff --git a/662/CH2/EX2.30/ex2_30.sce b/662/CH2/EX2.30/ex2_30.sce
new file mode 100755
index 000000000..0bd844a4d
--- /dev/null
+++ b/662/CH2/EX2.30/ex2_30.sce
@@ -0,0 +1,6 @@
+ //Example 2.30
+funcprot(0);
+c = int8(12);
+star='*';
+Sum=0; //sum is a keyword in scilab
+Factor = 0,21023e-6; //factor is keyword in scilab
diff --git a/662/CH2/EX2.34/ex2_34.sce b/662/CH2/EX2.34/ex2_34.sce
new file mode 100755
index 000000000..f6cf033f0
--- /dev/null
+++ b/662/CH2/EX2.34/ex2_34.sce
@@ -0,0 +1,8 @@
+//Example 2.34
+ clc
+funcprot(0);
+printf("Enter the value of radius:");
+radius=scanf("%d");
+pi=3.141593;
+circumference = 2 * pi * radius;
+area = pi* radius*radius;
diff --git a/662/CH2/EX2.35/ex2_35.sce b/662/CH2/EX2.35/ex2_35.sce
new file mode 100755
index 000000000..14572262e
--- /dev/null
+++ b/662/CH2/EX2.35/ex2_35.sce
@@ -0,0 +1,13 @@
+ //Example 2.35
+ clc
+funcprot(0);
+printf("Enter the value of n:");
+n=scanf("%d");
+count=1;
+sum=0;
+while count <= n
+ printf("x = ");
+ x=scanf("%f");
+ sum = sum + x;
+ count = count+1;
+end
diff --git a/662/CH2/EX2.5/ex2_5.sce b/662/CH2/EX2.5/ex2_5.sce
new file mode 100755
index 000000000..854914872
--- /dev/null
+++ b/662/CH2/EX2.5/ex2_5.sce
@@ -0,0 +1,5 @@
+ //Example 2.5
+ clc
+funcprot(0);
+sum = 10+ 20;
+printf("%d\n", sum);
diff --git a/662/CH2/EX2.6/ex2_6.JPG b/662/CH2/EX2.6/ex2_6.JPG
new file mode 100755
index 000000000..f4a784c7f
--- /dev/null
+++ b/662/CH2/EX2.6/ex2_6.JPG
Binary files differ
diff --git a/662/CH2/EX2.6/ex2_6.sce b/662/CH2/EX2.6/ex2_6.sce
new file mode 100755
index 000000000..03d0a0f30
--- /dev/null
+++ b/662/CH2/EX2.6/ex2_6.sce
@@ -0,0 +1,10 @@
+ //Programming example 2.6
+clc
+printf("Enter the two integer values to be added:");
+printf("\n[Enter the numbers in single line seperated by spaces]");
+
+//enter values in single line seperated by spaces
+[num1, num2]=scanf("%d %d");
+// "sum" is a keyword hence could not be used. Hence
+Sum=num1+num2;
+printf("Addition of %d and %d = %d \n", num1, num2, Sum);