Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- int main() {
- int vetor[] = {2,6,7,10};
- int soma = 0;
- int tamanhoVetor = sizeof(vetor)/sizeof(int);
- double meioDoVetor = tamanhoVetor/2;
- meioDoVetor = ceil(meioDoVetor);
- int vetorCoringa = vetor[(int) meioDoVetor];
- for(int i = 0;i<tamanhoVetor;i++){
- if(vetor[i]!=vetorCoringa){
- soma+=vetor[i];
- }
- }
- std::cout<<"y="<<soma;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement