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

array_tutorials

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

array_tutorials

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

1.

Write a program to find the sum of n numbers and display the numbers
and the sum.
2. Write a program to search for a key value in a set of numbers.
3. An election is contested by 5 candidates. The candidates are
numbered 1 to 5 and the voting is done by marking the candidate
number on the ballot paper. Write a program to read the ballots and
count the votes cast for each candidate using an array variable count.
In case, a number read is outside the range 1 to 5, the ballot should
be considered as a ‘spoilt ballot’ and the program should also count
the number of spoilt ballots.
4. Write a program to sort a list of numbers in ascending order using
bubble sort.
5. Given are two one-dimensional arrays A and B which are sorted in
ascending order. Write a program to merge them into a single sorted
array C that contains every item from arrays A and B, in ascending
order.
6. Write a program to find the sum of two matrices.
7. Write a program to calculate the product of two matrices.
8. Write a program to read a matrix of size m x n and print its
transpose.
9. Write a program to read n characters and display the same in
reverse order.

10. Write a program that will count the number occurrences of a


specified character in a given line of text.

You might also like