fork download
  1. /** Created by : Tipu **/
  2. /** Date : 19-12-2024 **/
  3. /** Time : 18:01:03 **/
  4. #include<iostream>
  5. using namespace std;
  6. int main(){
  7.  
  8. int N; cin>>N;
  9.  
  10. int Digit; cin>>Digit;
  11.  
  12. int x;
  13. int Sum = 0;
  14. while(Digit != 0){
  15.  
  16. x = Digit % 10;
  17.  
  18. Sum = Sum + x;
  19.  
  20. Digit = Digit / 10;
  21. }
  22.  
  23. cout<<Sum;
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
23