c++ program to find the sum of the digits of number
source code :
//WAP to find the sum of the digits of number
#include<iostream>
using namespace std;
int main(){
int t;
cout<<"Enter the number of test cases : "<<endl;
cin>>t;
for(int i = 1;i<=t;i++){
int n,rem,sum=0;
cout<<"ENter the number: "<<endl;
cin>>n;
while(n!=0){
rem=n%10;
sum=sum+rem;//
n=n/10;
}
cout<<"the sum of the digits of number is : "<<sum<<endl;
}
return 0;
}
ConversionConversion EmoticonEmoticon