Assignment 5
Assignment 5
Practice Assignment - 5
-------------------------------------------------------------------------------------------------------
Instructions:
Proper indentation is mandatory.
You should comment the statements whenever necessary, to make the code
understandable.
Answers files: 5_1.c, 5_2.c, 5_3.c, 5_4.c, 5_5.c, 5_6.c
Q1. Suppose we divide a one-dimensional array of integers of length 2n (where n is only) into two
equal parts and then fold each part at its middle position. Swap the elements that overlap with each
other in those respective parts.
e.g.
Q2. Write a function Power() to raise a number m to a power n, where m and n are integers. Write a
main that gets the values of m and n from the user and then calls Power() by passing m and n values
as parameters.
Q3. Write a program that reads a floating point number and then displays the right-most digit of the
integral part of the number. For example, if 123.45 is the input, then 3 should be the output.
Q4. Write a program to store 10 numbers in 1-D array and then sort the array in ascending order.
After sorting display the sorted list.
Q5. Write a program to store 9 numbers in 3 by 3 matrix then transpose the matrix.