
Assignment: 01
Deadline: 21st Feb. 2012
1. Declare two integer arrays of sizes 10 each. Your task is to print the elements which are
common in both the arrays.
Sample Input:
a[]: 1,2,3,4,5,6,7,8,9,20
b[]: 2,4,6,8,10,12,14,16,18,20
Sample Output:
Common elements: 2, 4, 6, 8, 20
2. Write a program which will take a character array a[] of size 15 and a character array b[] of size
10 from the user. Also take an index from the user, and starting from the given index place array
b[] in array a[]. At the end, display a[].
Sample Input:
a[]: program
b[]: computer
Index: 3
Sample Output:
a[]: procomputer
3. Declare a character array A[] of size 15 and B[] of size 10. Take input in both the arrays. Your
task is to search the contents of array B[] in array A[].
Sample Input: A[ ] = helloworld B[ ] = hello
Sample Output: Word found
Sample Input: A[ ] = helloworld B[ ] = good
Sample Output: Word not found
4. Declare a character array of size 20. Take input in the array (including spaces). Your task is to
capitalize 1st letter of each word, and if the first letter is already a capital letter then replace the
3rd letter with @.
Sample Input: Hello world
Sample Output: He@lo World