/* title: duplicateElimination author: aeriqusyairi date: Jan26 2012 */ #include<stdio.h> #define SIZE 20 int main(){ int array[ SIZE ] = { 0 }; int i, j, k = 0, h, number; printf("Input 20 number between 10 and 100 (inclusive)...\n"); for(i = 0, h = 0; i < SIZE; i++, k = 0, h++){ scanf("%d", &number); for(j = 0; j < SIZE; j++){ if(number == array[ j ]) k = 1; } if(k == 0){ printf("You entered an exclusive number %d\n", number ); array[ h ] = number; } } system("pause"); return 0; }
My C Repository
C How to Program
Sweet thanks to my broski Yusuke Fiz for this Deitel book.
You light up my life dude.
Just another personal public repository.
Friday, March 16, 2012
Duplicate Elimination
Read in 20 numbers, each of which is between 10 and 100, inclusive.Then print it only if it's not duplicate of a number already read.
Labels:
C,
Chapter 6: C Arrays
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment