I want to single value if you give any integer value. Below are examples
1. Input: 123 Output: 6
2. Input: 99 9+9=18 1+8 Output: 9
How to get above output?
Answer / vamshireddy
console.writeline("enter ur number");
int i=int.parse(console.readline);
int add=0;
int rem=0;
while(i!=0);
{
rem=i%10;
add=add+rem;
i=i/10;
}
console.writeline("result is"+add);
console.readline();
Is This Answer Correct ? | 5 Yes | 0 No |
What is a delegate?
What is thread pooling?
What is system console writeline in c#?
What is uint64_t?
What is the difference between TypeOf, GetType and what are the uses of TypeOf, GetType.
What is the difference between icomparer and icomparable in c#?
What does args mean in c#?
Which language is used for desktop application?
How do I know if executenonquery is successful c#?
What is the difference between first and firstordefault?
What is global namespace in c#?
What is the difference between int16 and int32 in c#?