May 23, 2024
c-program c ++

C or C++ Program to Show Sum of a Digit

This article describes about the program Sum of a digit in C/C++. Let us discuss about the digit sum or sub of a digit system.

Digit sum or Sum of a Digit
In mathematics the digit sum of a given integer is the sum of all its digits. That means the digit sum of 65001 is calculated as 6+5+0+0+1 = 12.

Program to Show Sum of a Digit

int main()
    long a,k,n,p;
    cout<<"This program will show Sum of a given digit."<<endl<<endl;
    cout<<"What is the digit ?. Give  a integer number or digit. "<<endl;     cin>>a;
    cout<<endl<<"Sum of given digit "<<n<<" is :"<<p;

Rashedul Alam

I am a software engineer/architect, technology enthusiast, technology coach, blogger, travel photographer. I like to share my knowledge and technical stuff with others.

View all posts by Rashedul Alam →

One thought on “C or C++ Program to Show Sum of a Digit

Leave a Reply

Your email address will not be published. Required fields are marked *