CantidadNumRepetidos

Zaid · December 31, 2020 · C++
#include <iostream>
#include <stdio.h>

using namespace std;
int array[10], i=0, c=0, n=0, buscar=0;
int main()
{
    cout<<"Ingrese cantidad de numeros a ingresar: ";
	cin>>n;
	for(i=0; i<n; i++){
		cout<<i+1<<": ";
		scanf("%d",&array[i]);
	}
	
	cout<<"Ingrese numero a buscar\n";
	cin>>buscar;
	
	for(i=0; i<n; i++){
		if(array[i]==buscar)
			c++;
	}
	if(c!=0){
		cout<<buscar<<" "<<c;
	}else{
		cout<<buscar;
	}
}  

Comments

Please sign up or log in to contribute to the discussion.