Answer to Question #295511 in C++ for Anshu

Question #295511

The input consists of an integer application ID representing the numeric application ID of the student

1
Expert's answer
2022-02-09T05:55:22-0500
#include<iostream>


using namespace std;


int digsum (int x)


{
    
    int dsum = 0;


    while (x != 0)


    {
        dsum += x%10 ;
  
        x = x/10 ;
  
    }
    
    if(dsum >= 1 && dsum <= 26)


        return dsum;


    else


        return digsum(dsum);


}


int main()


{
    
 int n,dsum=0;
 
 cout<< "Enter Application ID:\n";
 
 cin >> n;
 
 dsum  =digsum(n);
 
 cout<< "The Alphabetical set code is:\n";
 
printf("%c",'A'+dsum-1);
//cout << ("%c",'A'+dsum-1);
 
 return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog