Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Solved digit sum problem #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/digitSum.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include<bits/stdc++.h>
using namespace std;
class digitSum
{
public:
int getSum(int n)
{
int sum=0;
while(n!=0)
{
sum=sum+n%10;
n/=10;
}
return sum;
}
};