csansoon

P1.18 P37297 Control C101A

Sep 19th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.     int n,x,y,z;
  7.     cin >> n;
  8.    
  9.     z=(n%10);
  10.     y=(((n-z)/10)%10);
  11.     x=(((n-y-z)/100)%10);
  12.    
  13.     cout << x+y+z << endl;
  14. }
Add Comment
Please, Sign In to add comment