summaryrefslogtreecommitdiff
path: root/1034/CH2/EX2.3/example3.sce
diff options
context:
space:
mode:
Diffstat (limited to '1034/CH2/EX2.3/example3.sce')
-rwxr-xr-x1034/CH2/EX2.3/example3.sce28
1 files changed, 28 insertions, 0 deletions
diff --git a/1034/CH2/EX2.3/example3.sce b/1034/CH2/EX2.3/example3.sce
new file mode 100755
index 000000000..46eabc92f
--- /dev/null
+++ b/1034/CH2/EX2.3/example3.sce
@@ -0,0 +1,28 @@
+clear;
+clc;
+printf("\nExample 2.3\n");
+// comparision of 2 strings.
+a="hakunah";..........//string 1.
+b="matata";.............//string 2.
+disp(" a & b respectively are =");
+disp(a);
+disp(b);
+disp("comparing strings");
+z=strcmp(a,b);.........//comparision of 2 strings.
+if(z==0)
+ printf("\nMATCHED\n");.......// if strings matched strcmp returns 0.
+else
+ printf("\nNOT MATCHED\n");.........// if string doesn't matched strcmp returns -1.
+ end
+ q="akash";
+ w="akash";
+ disp("q & w respectively are=");
+ disp(q);
+ disp(w);
+ disp("comparing strings");
+ x=strcmp(q,w);
+ if(x==0)
+ printf("\nMATCHED\n");.......// if strings matched strcmp returns 0.
+else
+ printf("\nNOT MATCHED\n");.........// if string doesn't matched strcmp returns -1.
+ end \ No newline at end of file