Created
April 5, 2016 15:17
-
-
Save alonzoibarra97/9a58c0bb2bd6a8a0b11970cf9642a38e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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