Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- srand(time(NULL));
- int i,b,c;
- b=0;
- c=0;
- int tab[31];
- for (i=0;i<31;i++)
- tab[i]=rand()%10;
- for (i=0;i<31;i++)
- cout<<tab[i]<<",";
- cout<<endl;
- for(i=0;i<31;i++){
- b=b+tab[i];
- if (tab[i]>c)
- c=tab[i];
- }
- int d=0;
- for (i=0;i<31;i++)
- if (tab[i]==c)
- d++;
- int g=0;
- cout<<b<<endl;
- cout<<"najwieksza liczba to "<<c<<" wystepuje "<<d<<" razy"<<endl;
- for (i=0 ;i<31;i++)
- if (tab[i]!=c)
- if (tab[i]>g)
- g=tab[i];
- cout<<"druga najwieksza liczba to "<<g<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement