Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Hanoi University of Science and Technology EE3490E-Programming Techniques

Semester 1, Academic Year 2023/2024 EE3491 - Kĩ thuật lập trình


Lecturer: Hoàng Đức Chính

Homework 3
Students need to design other function(s) rather than writing everything in the main() function to solve the
problems below. Use the minimum of functions in the standard library.

Problem 1:
Write a program in C to count the number of vowels and consonants in a string using a pointer.

Problem 2
Write a program in C to find the frequency of all characters and/or a given character in a sentence
entered by users. Do not use standard libraries related to string. Use pointers where possible.

Problem 3:
Write a program in C which allows users to provide a string then extract all the characters in that
string and print out them in alphabetic order. The function(s) designed should use a pointer(s).

Problem 4:
Write a program in C to check whether a given number is Abundant or not. An abundant number or
excessive number is a number for which the sum of its proper divisors is greater than the number, e.g. 12 is
an abundant number as its proper divisors are 1, 2, 3, 4 and 6 and their summation is 16 > 12.

Problem 5:
Write a program in C to find the Deficient numbers (integers) between two integers using pointer(s).
A deficient number or defective number is a number n for which the sum of divisors of n is less than 2n. E.g.
the proper divisors of 8 are 1, 2, and 4, and their sum is less than 8, so 8 is deficient.

Student can try to solve this problem using dynamic memory allocation.

Problem 6:
Write a program in C to calculate the sum of numbers from 1 to n using recursion.

Problem 7:
a. Write a program in C to count the digits of a given number using recursion.
b. Write a program in C to find the sum of digits of a number using recursion.

Problem 8
Write a program in C to find the first n number of prime numbers using recursion.
Problem 9
Write a C program to print the square of array elements using callback function. Student can try to
solve this problem using dynamic memory allocation.

Problem 10
Create a linked-list consisting of public holidays of a year and description of each day (as string), so
that:

- A new public holiday can be added to the beginning of the list


- Search for the description of the day (input argument is a date including day and month)
- Delete a public holiday at the beginning of the list
- Delete a public holiday in the middle of the list (input argument is a date including day
and month)
- Clear the whole list
Write a program to demonstrate the usage of the above list.

You might also like