Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

sum of digits in c++

int x, s = 0;
   cout << "Enter the number : ";
   cin >> x;
   while (x != 0) {
      s = s + x % 10;
      x = x / 10;
   }
 
PREVIOUS NEXT
Tagged: #sum #digits
ADD COMMENT
Topic
Name
6+9 =