summaryrefslogtreecommitdiff
path: root/659/CH4/EX4.2/exm4_2.sce
blob: 55e0af429237cb0ad5d25835f043e034f9dd318b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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