Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdexcept>
- #include <algorithm>
- using namespace std;
- int SumaCifara (const int &n) {
- int pom(n), suma{0};
- while (pom!=0) {
- suma+=pom%10;
- pom/=10;
- }
- return suma;
- }
- int main () {
- cout<<"Unesite n: ";
- int n;
- cin>>n;
- int niz[10]={5,3,11,8,91,5,3,82,21,4};
- cout<<count_if(niz,niz+10, [n] (int x) {return SumaCifara(x)>n; });
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement