Created
March 9, 2016 01:59
-
-
Save DiegoNaterasPonce/8b10c51506af75c22a24 to your computer and use it in GitHub Desktop.
#Quiz5.2
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> | |
#include <iomanip> | |
using namespace std; | |
int z = 0, number; | |
float calc; | |
float find_threes (int y[], int x) | |
{or (int i = 0; i < x; i++) | |
{ | |
calc = y[i] % 3; | |
number = calc; | |
if (number == 0) | |
z = z + y[i]; | |
} | |
return z; | |
} | |
int main () | |
{ | |
int sum; | |
int x [sum]; | |
cout << "Give me the amount of numbers to sum : \n"; | |
cin >> sum; | |
for (int i = 0; i < sum; i++) | |
{ | |
cout << "Tell me a number: "; | |
cin >> x[i]; | |
} | |
cout << "The sum of the numbers that are divisible by three is : " <<find_threes (x, sum) <<endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment