PF Lab10
PF Lab10
Note that the elements on the main diagonal have been put in BLUE color, elements
on the antidiagonal have been put in GREEN color, and the common element
between the two diagonals (i.e. the center-most element) has been put in RED color.
These colors have been used just for your understandability, and the output produced
by your program will (obviously) not be colored.
Question # 2
A diagonal matrix is a matrix in which the entries outside the main diagonal are all
zero. The diagonal entries themselves may or may not be zero.
The identity matrix or unit matrix of size n is the n × n square matrix with ones on
the main diagonal and zeros elsewhere.
Sample Output:
Question # 3
Implement the following functions by your own:
• bool isUpper(char ch);
• bool isLower(char ch);
• bool isAlpha(char ch); //this one would tell if the character is an alphabet
• bool isSpace(char ch); //returns true on space ‘ ’, tab ‘\t’ and newline ‘\n’
• bool isDigit(char ch);
• char toUpper(char ch);
• char toLower(char ch);
Note: Show the working of your functions through driver code in main.
Question # 4