Last active
May 11, 2019 04:41
-
-
Save jkotra/b8047afab7575a0fc8ff3b02a9f1ec0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <conio> | |
using namespace std; | |
int main() | |
{ | |
long a = 0; | |
int b = 0; | |
clrscr(); | |
cout << "sum of digits of input number" << endl; | |
cout << "enter a number" << endl; | |
cin >> a; | |
while(a!=0){ | |
b = b+(a%10); | |
a = a/10; | |
} | |
cout << "required sum:" << b; | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment