Skip to content

Instantly share code, notes, and snippets.

@alonzoibarra97
Created April 5, 2016 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alonzoibarra97/9a58c0bb2bd6a8a0b11970cf9642a38e to your computer and use it in GitHub Desktop.
Save alonzoibarra97/9a58c0bb2bd6a8a0b11970cf9642a38e to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int i;
int find_threes(int numbers[], int cant ){
int n=0;
for(int i=0; i<cant; i=i+1)
{
if(numbers[i]%3==0){
n=n+numbers[i]; }
}
return n;
}
int main() {
int cantidad;
cout<< "How many numbers do you want to introduce\n";
cin>> cantidad;
int a[cantidad];
for( i=0; i<cantidad; i++){
cout<<"Give me the number: ";
cin>> a[i];
}
int s= find_threes(a,cantidad);
cout<<"The result is: "<< s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment