Hye all!! here is an program statement i don't know how to do it :o ..so plz let me know itz solution...
program is written below:-
Write a program that will get 10 numbers between 20 and 100 and store them in one dimensional array of type int , as each number is entered by the user from keyboard. Your program will check that if number is between the range of 20 and 100. Now there are two cases:

1. The number is already entered by the user then it will not be stored in array and your program will continue to get next number from the user.


2. The entered number is unique and was not previously entered by the user now your program will store that number in the array and continue to get next number from the user.

At the end your program will simply display the non duplicate values entered by the user.

Sample output:

Out put of your program will be as followed:


Enter 10 values between 20 and 100
Enter Value
50
Enter Value
60
Enter Value
70
Enter Value
56
Enter Value
89
Enter Value
200
your value should be between 20 and 100
Enter Value
47
Enter Value
50
Enter Value
5
your value should be between 20 and 100
Enter Value
56
Enter Value
95
Enter Value
21
The non duplicate values are: 50 60 70 56 89 47 95 21

Recommended Answers

All 7 Replies

I notice a lack of attempt on your part. It seems like you're asking us to do your work for you.

It doesn't work that way around here. Sorry.

actually i need to know how to check that the numbers entered by the user are b/w the range of 20 and 200..how can we check it in array...

for ( i = 0; i < size; i++ ) {
  if ( array[i] < 20 || array[i] > 100 )
    error();
}

can u plz explain error();

>can u plz explain error();
I would think it was obvious. It's a placeholder meaning "error code goes here".

If you preffer you can use

exit()

instead of error()

That's not any help. As pseudocode, it's no better than error(), and in real code, exit requires an argument. So either way, you've gained nothing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.