Question is:
Use a single-subscripted array to solve the following:
Read in 20 numbers, each which is between 10 and 100. As each number is read, print it only if it's not a duplicate of a number already read.
I have done this thing:
Code:
#include<stdio.h>
#define SIZE 20
int main()
{
int arry[ SIZE ] =
{ 10, 100, 95, 62, 41, 23, 15, 15, 100, 62,
89, 66, 95, 55, 55, 22, 81, 22, 63, 21 };
int i, pass, hold;
/* Bubble Sort */
for( pass = 1; pass < SIZE; pass++ )
{
for( i = 0; i < SIZE - 1; i++ )
{
if( arry[ i ] > arry[ i + 1 ] )
{
hold = arry[ i ];
arry[ i ] = arry[ i + 1 ];
arry[ i + 1 ] = hold;
}
}
}
for( i = 0; i < SIZE; i++)
{
if( arry[ i ] == arry[ i + 1 ] )
{
continue;
}
else
{
printf( "M", arry[ i ] );
}
}
printf( "\n\n" );
}
please help me correct it!