YAMILDIAZ

ejercicio 2

Jun 14th, 2023
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | Source Code | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5.  
  6. int main(){
  7. const int tam = 5;
  8. int vNum[tam];
  9. int i, num, numNew;
  10.  
  11. for (i = 0; i < tam; i++){
  12.     cout<<"ingrese un numero: ";
  13.     cin>>num;
  14.     vNum[i]=num;
  15. }
  16. cout<<"ingrese un numero nuevo: ";
  17. cin>>numNew;
  18.  
  19. for (i = 0; i < tam; i++){
  20.     if (vNum[i]==numNew){
  21.         cout<<"el numero ingresado pertenece a la lista anterior";
  22.     }
  23. }
  24.  
  25. cout<<endl;
  26. system("pause");
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment