Skip to content

Commit

Permalink
Merge pull request #4 from Jain-Saksham/Jain-Saksham-patch-4
Browse files Browse the repository at this point in the history
Sum Of Digits
  • Loading branch information
Jain-Saksham authored Oct 25, 2021
2 parents 096d5b2 + af7020e commit 4fef725
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sum_of_digits.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<bits/stdc++.h>
using namespace std;

int main() {
int n;
cin>>n;
int sum=0;
while(n!=0)
{
sum+=n%10;
n/=10;
}
cout<<sum;
return 0;
}

0 comments on commit 4fef725

Please sign in to comment.