Skip to content

Instantly share code, notes, and snippets.

@sofhiasouza
Created August 23, 2019 13:55
Show Gist options
  • Save sofhiasouza/8b33473cd7f92da6c9964f6c4d060a4b to your computer and use it in GitHub Desktop.
Save sofhiasouza/8b33473cd7f92da6c9964f6c4d060a4b to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int cont2 = 0, cont3 = 0, cont4 = 0, cont5 = 0;
for(int i = 1 ; i <= n ; i++)
{
int a;
cin >> a;
if(a%2 == 0) cont2++;
if(a%3 == 0) cont3++;
if(a%4 == 0) cont4++;
if(a%5 == 0) cont5++;
}
cout << cont2 << " Multiplo(s) de 2\n";
cout << cont3 << " Multiplo(s) de 3\n";
cout << cont4 << " Multiplo(s) de 4\n";
cout << cont5 << " Multiplo(s) de 5\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment