PDA

View Full Version : Assignment No. 02 Semester: Spring 2010 CS201: Introduction to Programming



viki
05-03-2010, 09:12 PM
Due Date:07/05/2010

Problem Statement: Finding the repeated elements in an array
You are required to write a program that takes 10 integer values in an array as input from user. After getting input, the program should find the elements with repetition and number of times each element is repeated.


Detailed Description:

1. Declare an integer type array.
2. Take input from user in the array i.e. 10 integer values.
3. Pass this array to a function which will calculate and display the number of times an element is repeated.
4. If the array contains elements with repetition, the program should only display the repeated elements and their count.
5. If there is no repetition in the array, the program should simply display the message “There is no repetition in the array”.

Sample Output 1
Enter the value of array element 1 : 8
Enter the value of array element 2 : 6
Enter the value of array element 3 : 2
Enter the value of array element 4 : 4
Enter the value of array element 5 : 2
Enter the value of array element 6 : 2
Enter the value of array element 7 : 7
Enter the value of array element 8 : 8
Enter the value of array element 9 : 5
Enter the value of array element 10 : 6


2 is repeated 3 times
6 is repeated 2 times
8 is repeated 2 times


Sample Output 2
Enter the value of array element 1 : 1
Enter the value of array element 2 : 3
Enter the value of array element 3 : 8
Enter the value of array element 4 : 7
Enter the value of array element 5 : 4
Enter the value of array element 6 : 9
Enter the value of array element 7 : 6
Enter the value of array element 8 : 5
Enter the value of array element 9 : 0
Enter the value of array element 10 : 2


There is no repetition in the array

Islam Gul
11-20-2010, 08:04 PM
i need it solution plz share it,

Xpert
11-20-2010, 08:25 PM
find it on this link (http://vuhelp.net/mcs/2898-cs201-introduction-programming-fall-2010-second-assignment-solution.html)