Advertisement
efeertas

Untitled

Mar 14th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #define Nums 21
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main (void){
  7. int numbers [Nums]={0};
  8. int isDuplicate, user_input;
  9. int a,z;
  10.  
  11. int numberofinputs = 0;
  12.  
  13. cout << "Please enter 21 numbers" << endl;
  14.  
  15. for (a=0; a<= Nums-1, a++)
  16.     isDuplicate=0;
  17. scanf ("%d", &user_input);
  18.  
  19. for (z=0; z<numberofinputs; z++){
  20.     if(user_input =numbers[z]){
  21.         isDuplicate=1;
  22.         break;
  23.  
  24.     }
  25. }
  26. if(!isDuplicate){
  27.  
  28.     numbers[numberofinputs++]=user_input;
  29.  
  30. }
  31. }
  32.  
  33. cout << "Non duplicate numbers are " << endl;
  34.  
  35. for (a=0; a<Nums && numbers[a]!=0;a++){
  36.  
  37.     cout << "(%d,numbers [a]" << endl;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement