The question is as follows:

Write a program to prompt the user to input five integers in the range [0,9] and then output the followings:

1. the numbers in ascending order.

2. the numbers that occur three times in the user input.

3. the numbers that occur twice in the user input.

Example: For the user input: 2 3 5 5 3,

1. the sorted order is: 2 3 3 5 5

2. no numbers occur three times

3. the numbers that occur twice are: 3 5

One possible idea:

Declare an array (size of 5) of integers named hand for storing the five user inputs.

Declare an array (size of 10) of integers named count for counting the number of occurrences of each possible value in the user input.

Example:

count becomes [0 0 1 2 0 2 0 0 0 0 ] for the user input: 2 3 5 5 3

Then print the sorted array using count.

Use the array count to check for values that occur twice or three times.

i have done the first question

but i have no idea with question 2 and 3

please help me

my program is as follows:

#include<stdio.h>

void main()

{

int hand[4],count[10]={0,1,2,3,4,5,6,7,8,9},j,i=0,temp;

for (i=0;i<4;i++)

{

do {printf("Enter the num%d:",i);

scanf(" %d",&hand[i]);

} while (hand[i]<0 || hand[i]>9);

}

for(j=0;j<4;j++)

{

for(i=0;i<4;i++)

{

if(hand[i]>hand[i+1])

{

temp=hand[i];

hand[i]=hand[i+1];

hand[i+1]=temp;

}

}

}

printf("The sorted order is");

for(i=0;i<4;i++)

printf("%3d",hand[i]);

getch();

}