diff options
Diffstat (limited to '659/CH4/EX4.2/exm4_2.sce')
-rwxr-xr-x | 659/CH4/EX4.2/exm4_2.sce | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/659/CH4/EX4.2/exm4_2.sce b/659/CH4/EX4.2/exm4_2.sce new file mode 100755 index 000000000..55e0af429 --- /dev/null +++ b/659/CH4/EX4.2/exm4_2.sce @@ -0,0 +1,14 @@ +// Example 4.2
+// The program requests the user to enter a character and display a message on
+// the screen telling the user whether the character is an alphabet or digit,
+// or any other special character.
+
+disp("Press any key");
+character=scanf("%c"); //Reading character
+if (isletter(character)) then //Test for letter
+ disp("The character is a letter");
+ elseif (isdigit(character)) then //Test for digit
+ disp("The character is a digit");
+ else
+ disp("The character is not alphanumeric");
+ end
\ No newline at end of file |