0% found this document useful (0 votes)
10 views

Array Practice (2)

Uploaded by

kandydiva123
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Array Practice (2)

Uploaded by

kandydiva123
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Array – 10.10.

24
1. Write a C Program to Print the Alternate Elements in an Array.
2. Write a C Program to find 2 Elements in the Array such that Difference between
them is Largest

Approach:

The largest difference between two elements in an array occurs when we subtract the smallest
element from the largest element. Therefore, to find the largest difference, we need to:

Find the minimum element in the array.


Find the maximum element in the array.
The largest difference will be: largest difference=max element−min element
largest difference=max element−min element

3. Write a C program to print the array in ascending order.


a. Selection sort
b. Bubble sort
c. Insertion sort

4. Write a program to check if two strings are anagrams using character arrays.
Approach: rearrangement of the same set of characters.
Example: {Silent, Listen}, (Triangle, Integral}
5. Implement a C program to reverse the words in a sentence using an array and store it
in a separate array.
6. Write a program in C to count the total number of duplicate elements in an array.
7. Write a program in C for a 2D array of size 3x3 and print the matrix.
8. Write a program in C to merge two arrays of the same size sorted in descending order.
9. Write a program in C to count the frequency of each element of an array.
10. Write a program in C to delete an element at a desired position from an array.
11. Write a program in C to count the total number of alphabets, digits and special
characters in a string.
12. Write a program in C to count the total number of vowels or consonants in a string.
13. Write a program in C to find the maximum number of characters in a string.
14. Write a program in C to extract a substring from a given string.
15. Write a C program to check whether a substring is present in a string.

You might also like