program to print sum of its integer in given digit
#include <iostream>
using namespace std;
int main()
{
int num, temp, sum=0;
cout << "\n Enter your number: ";
cin >> num;
while(num > 0)
{
temp = num%10;
num = num/10;
sum = sum + temp;
}
cout << "\n the sum of integer in your digit is: " << sum << endl;
return 0;
}
OUTPUT:
No comments:
Post a Comment