How to print the sum of a Number of 4 digit for loop c++ By Munavar Ahmad How to print the sum of a Number of 4 digit for loop c++ By Munavar Ahmad #include<iostream> using namespace std; int main() { int num,a,b,c,d,e,f,sum; cout<<"Enter A number of 4 digits"; cin>>num; a=num%10; b=num/10; c=b%10; d=b/10; e=d%10; f=d/10; sum=a+c+e+f; cout<<"The Sum Of Digits is"<<" "<<sum; return 0; }
0 comments:
Post a Comment
If You Have Any Problem While Downloading Comment Below