Question

Write a menu driven program (using switch-case) which accepts a number as user input: A) Prints sum of digits of the given number B) Prints reverse of the given number.

02 Apr 2022
Answer :
Word Count : 621

Creating a menu-driven program using a switch-case statement in a programming language like C++ will allow us to achieve the tasks of calculating the sum of digits and reversing a given number. Below is an example in C++ to fulfill this requirement:

```cpp
#include <iostream>
using namespace std;

// Function to calculate the sum of digits of a number
int sumOfDigits(int number) {
    int sum = 0;
    while (number != 0) {
        sum += number % 10;
        number /= 10;
    }
__________ ________ ________ ____ __________ _______ _________ ______ __________.
_______ ________ _____ _________ _____ _______ _____ _______ ___ __________.
___ ___ ______ ________ _________ ____ ________ ________ ________ _________ ________.
_______ _________ ___ ____ ____ __________.
_______ ____ _______ _____ ____ _________.
_________ ______ ____ __________ ___ _______ __________ ______ _________.
_____ _______ _________ _________ _____ _____ ________ ______ ___.
_______ __________ _____ __________ _____ _______ ____ _________.
________ _____ _____ _______ _________ _______ ______ _________.
______ ___ ____ _______ ____ ____ ____ ______ ___ ________ __________.
_________ ______ _____ __________ ______ _____ _________.
_________ _______ __________ _____ ________ _____ ______ _____.
_______ __________ _________ __________ __________ _______ _______ _______ _______ ______.
___ ______ _______ _______ ____.
_________ ______ _______ ___ ________ ___ _________ _____.
__________ _________ ____ ________ _____ ____ _____.
__________ ______ ________ _______ ______ ______ __________ _________.
_____ ____ _______ ____ _____ ____ ___.
_____ ________ ________ ____ _____ ______.
_______ _____ ______ ________ ______ ________ ________.
________ __________ ___ ______ ___ _____ __________.
_______ _________ _______ __________ _________ _________ _________ _______ ______ _____ ______.
____ _________ ___ _______ _______.
_________ _______ ___ _______ __________ ________.
______ ___ _____ ________ ________ ________ _____.
_______ _____ _________ ___ ___ ________ ___ ____ _______.
__________ __________ _________ ___ ____ _____ _______ __________.
______ ______ ___ _____ _________ _________.
________ _______ _______ _________ ______ ________.
_________ ____ _____ ___ ___ ____ _________ __________ ___ ________ ______.
________ ___ _______ ______ __________ _________ ___ _________.
_________ _____ _________ _________ _______ _______ ____ _______ ______ ____ _____ ___.
_____ ______ ____ ______ _____ _______ ________ ________.
______ ______ _________ ____ __________ _____ _____ ____ _______ ___.
____ __________ _____ _________ ________ __________ _____ __________ ____ _________.
_____ ______ _______ _________ ____ ________ ____.
________ _____ ______ ___ __________ _______ _________ _______.
___ _________ __________ _______ ______ __________.
___ ________ ____ _______ ________.
________ ________ __________ ___ _______ _____.
_________ ________ ______ _______ ________ ______.
_______ _________ ________ ________ _____ __________ _____ ________ ___.
______ ____ ______ ______ _______ _____ _________ _________ _______ _____ ___.
___ _________ ___ ___ __________ __________ _____ ______.
_________ ______ _______ __________ ____ _______ _____ ____ ____ ________ ________.
______ ________ ____ _______ ______ ___ _____ _____ ________.
_______ ___ _________ ________ __________.
_______ ______ _______ _______ __________ _______ __________ __________ ____ _____.
_________ ______ _________ ____ ________ ____ _________ _____ _____ _________ ____.
___ ________ ___ ________ _________ ___ ______ __________ __________ ___ _________ ______.
___ _________ ___ _______ _________ _______ _____ ________ _________ __________.
__________ _________ ______ ________ __________ _____ ___ _________ _________.
______ _______ _______ ______ _____ __________.
________ _________ _________ ______ _________.
_______ ____ __________ __________ ____ ____ _____ _________.
__________ _______ _____ __________ _______ ___ ________ ________ _______ __________ ___.
_______ ____ ________ ______ __________ _________ ___ _______ ___ __________ ______ ____.
_______ ____ _____ ________ _________ _______ __________ _________ ________ ___ ____.
________ _____ ______ __________ ______ __________ _______ __________ ________ ______ ______ ___.
___ ________ ______ ________ _____.
_____ __________ ______ ______ ______ _________ ______ ___ _______ __________ ____ _____.
___ ________ __________ __________.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Write a menu driven program (using switch-case) which accepts a number
🟢
WhatsApp Chat Fast live messaging
Email Us Business enquiries & support