0% found this document useful (0 votes)
2 views2 pages

PPS Assignment Problems

Uploaded by

samir241-15-361
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

PPS Assignment Problems

Uploaded by

samir241-15-361
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PPS Assignment Problems

Topics: Functions, Pointers, Strings, Structures

1. Write a function that will find the sum of as many numbers as the user wants
to.
2. Greatest Common Divisor (GCD): Write a function int gcd(int a, int b)

that finds the greatest common divisor of two integers a and b.

3. Palindrome Checker: Write a function int is_palindrome(char str[])

that checks if a given string str is a palindrome (reads the same backward as

forward).

4. Prime Number Checker: Write a function int is_prime(int num) that

determines if a given number num is prime.

5. String Length (without using strlen): Write a function int

string_length(char str[]) to find the length of a string str (without using

the built-in strlen function).

6. Swap Two Numbers: Write a function void swap(int *x, int *y) that

swaps the values of two integers pointed to by x and y.

7. Array Sum with Pointers: Write a function int sum_array(int arr[], int

size) that calculates the sum of elements in an array arr of size size using

pointers.

8. Reverse an Array: Write a function void reverse_array(int arr[], int

size) that reverses the elements of an array arr of size size in-place using

pointers.

9. Find Maximum in an Array: Write a function int find_max(int arr[], int

size) that finds the maximum element in an array arr of size size using

pointers.

10. String Copy (without using strcpy): Write a function void

string_copy(char dest[], char src[]) that copies a source string src to

a destination string dest (without using the built-in strcpy function).


11. Count Vowels and Consonants: Write a program that counts the number of

vowels and consonants in a given string.

12. Extract Words from a String: Write a program that extracts individual words

from a string separated by delimiters (e.g., spaces, commas).

13. Replace Substring: Write a function void replace_substring(char str[],

char old_sub[], char new_sub[]) that replaces occurrences of a substring

old_sub in a string str with a new substring new_sub.

14. Convert String to Uppercase/Lowercase: Write functions void

to_uppercase(char str[]) and void to_lowercase(char str[]) to

convert a string str to uppercase and lowercase, respectively.

15. Check if String is a Substring of Another: Write a function int

is_substring(char str[], char sub[]) that checks if a string sub is a

substring of another string str.

16. Write a c program to find the position of the first occurrence of a given

character in a string.

17. Write a program to find occurrences of each character in a string.

18. Date Structure: Define a structure Date to hold day, month, and year. Write

functions to check if a date is valid and calculate the difference between two

dates.

19. Student Record: Create a structure Student to store student information

(name, roll number, marks in various subjects). Write functions to create,

display, and calculate the total marks for a student.

20. Date Structure: Create a structure to represent a date (day, month, year)

and functions to compare two dates, calculate the difference between dates,

and perform other date-related operations.

You might also like