Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. // Zad9TUVARNA.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. int chislo;
  11. int sum = 0;
  12. cin >> chislo;
  13. for(int i=0;i<10;i++) {
  14. int num = chislo % 10;
  15. chislo = chislo / 10;
  16. sum += num;
  17. }
  18. cout << sum << endl;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement