Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Zadajte pocet prvkov pola, najviac 20" << endl;
- int A[20],B[20],n,i,m,j,k,pom,pocet=0,je=0;
- cin>>n;
- cout<<"Zadajte lubovolne cisla do pola, ja napisem ktore cisla sa opakuju"<<endl;
- for (i=0;i<n;i++)
- {
- cin>>m;
- A[i]=m;
- }
- for (i=0;i<n;i++)
- {
- pom=0;
- je=0;
- for (k=0;k<pocet;k++)
- {
- if(A[i]==B[k])
- je=1;
- }
- if(je==0){
- for (j=0;j<n;j++)
- {
- if (A[i]==A[j])
- {
- pom++;
- }
- }
- }
- if (pom>1){
- B[pocet++]=A[i];
- cout<<"Cislo "<<A[i]<<" sa opakuje "<<pom<<" krat"<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement