Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void numar(int n, int c1, int c2, int &x)
- {
- x=0;
- while(n)
- {
- if(n%10>=c1 && n%10<=c2)
- x=x+n%10;
- n=n/10;
- }
- }
- int main()
- {
- int x;
- numar(123, 2, 7, x);
- cout<<x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement