$25
Objectives:
At the end of the class the students should be able to:
• Use character arrays in C programs.
• Use two dimensional arrays in C programs.
Exercise 1
Write a C program to read a name from the keyboard , store it in an array and then display it backwards. Allow the length of the name to be unspecified (terminated by pressing the Enter key). Assume that maximum number of characters is 20.
Exercise 2
Write a C program to read a word from the keyboard and store in a character array. Convert the word into all capital letters and display on the screen.
Hint : ‘a’ – 97, ‘z’ - 122, ‘A’ – 65, ‘Z’ - 90
Exercise 3
Write a C program to declare an integer array called arr1 with 3 rows and 3 columns. Read 12 numbers from the keyboard and store in the array. Find the transpose of the arr1 and store the result in arr2.
1
2
3
4
5
6
7
8
9
arr1
1
4
7
2
5
8
3
6
9
arr2
1