YAMILDIAZ

ejercicio 3

Jun 14th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | Source Code | 0 0
  1. int main(){
  2. const int tam = 5;
  3. int vNum[tam];
  4. int i, num, menor, cantMenor=0;
  5.  
  6. for (i = 0; i < tam; i++){
  7.     cout<<"ingrese un num: ";
  8.     cin>>num;
  9.     vNum[i]=num;
  10. }
  11.  
  12. menor = vNum[0];
  13. for (i = 0; i < tam; i++){
  14.     if (vNum[i]<menor){
  15.             menor = vNum[i];
  16.     }
  17. }
  18.  
  19. for (i = 0; i < tam; i++){
  20.          if (vNum[i]==menor){
  21.             cantMenor++;
  22.     }
  23. }
  24. cout<<"el numero menor es: "<<menor<<endl;
  25. cout<<"cantidad de numeros iguales al menor: "<<cantMenor;
  26.  
  27. cout<<endl;
  28. system("pause");
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment