Thread: C programming
View Single Post
Old 07-22-11, 07:45 AM   #13
Addison_16
Registered User
 
Join Date: Jul 2011
Posts: 1
Default Re: C programming

#include <stdio.h>
int main()
{
int a[ MAX ] = { 0 };
int i, j,k = 0;
int duplicate;
int value;
printf( "Enter 20 numbers between 10 - 100;\n" );
for ( i = 0; i <= MAX - 1; i++ ){
duplicate = 0;
scanf( "%d", &value);
for ( j = 0; j < k; j++ ) {
if ( value == a[ j ] ) {
duplicate = 1;
break;
{



/* enter number into array if it's not a duplicate */
if ( !duplicate )

a[ k++ ] = value;

} /* end if */
__________________
Cegonsoft
Addison_16 is offline