1. Course
  2. Functions B
  3. Function to add the digits of a number

Function to add the digits of a number


Last updated: 8/23/2020 Difficulty: Intermediate

Create a C# program that asks the user for a number and save it in a text string. You must implement a function called AddDigits that receives the text as a parameter and returns the sum of its digits.

Input

2222222222222222222222

Output

44

Solution

Functions B

2 / 6

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising