Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<math.h>
- using namespace std;
- int main(){
- int n, cont=0;
- cout << "Digite o tamanho do vetor" << endl;
- cin >> n;
- int v[n];
- cout << "digite os componentes ";
- for(int i=0; i<n; i++){
- cin>> v[i];
- }
- int maior = v[0];
- for(int j=0; j<n; j++){
- if(maior<v[j]){
- maior = v[j];
- }
- }
- cout<<"O maior elemnto ocorre nas posicoes: "<<endl;
- for(int k=0; k<n; k++){
- cont++;
- if(v[k]==maior){
- cout<<cont<<" ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment