COMSATS Institute of Information Technology Lahore: Assignment 3 - Semester FALL 2020
COMSATS Institute of Information Technology Lahore: Assignment 3 - Semester FALL 2020
Q 1. Write a function average which accepts an array and calculate and return the average of the even numbers of
the array to the main function.
Q 2. Write a function that displays the values on the diagonal of its 10 x10 matrix parameter.
C. Write a loop to print the first seven rows of the array, each on a single line.
D. Write a loop to print the entire array backward and upside down, so that the last line appears first, with the
last column on the left.
Q 4. Write loops that perform each of the following single-subscripted array operations:
Page 1 of 2
Q 7. Write a C Program to count vowels, consonants, digits, special characters in a given string.
Q 8. Input a string and print “Only Alphabets” if the string only contains alphabets(A-Z, a-z), “Only numbers” if
the string only contains numerical digits(0-9), “Only Alphanumeric” if the string only contains alphabets and
numerical digits(A-Z, a-z, 0-9) or “Mixture” if there are other characters too. Ignore space character while
computing the result. Assume that the input string will be less than 50 characters long.
Q 9. Write a program that inputs four strings that represent floating-point values, converts the strings to double
values, sum the values and print the total of the four values.
Q 10. Implement the following built-in functions with the help of examples.
isdigit(), isalpha()
strcmp() &strlen()
Q 11. Write a program that inputs a line of text and a search character and uses function strchr to determine the
total occurrences of the character in that line. You must input the string from the user.
Sample Output:
Q 12. Write a program that will create a database for your class. Create an array of structure to store the records of
the students. Store the records of at least 10 students. Your program should display the single record one at a line.
Page 2 of 2