From af7020ef4ff70e265a8946f27cfa37cb6c6c2181 Mon Sep 17 00:00:00 2001 From: Jain-Saksham <53533762+Jain-Saksham@users.noreply.github.com> Date: Mon, 25 Oct 2021 18:47:31 +0530 Subject: [PATCH] Add files via upload --- sum_of_digits.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sum_of_digits.cpp diff --git a/sum_of_digits.cpp b/sum_of_digits.cpp new file mode 100644 index 00000000..2b7cbad8 --- /dev/null +++ b/sum_of_digits.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; + +int main() { + int n; + cin>>n; + int sum=0; + while(n!=0) + { + sum+=n%10; + n/=10; + } + cout<