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 Posted / 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 |
Post New Answer View All Answers
Explain how to use an extender provider in the project.
in object oriented programming, how would you describe encapsulation?
What are the benefits of using windows services:
What is the use of base keyword? Tell me a practical example for base keyword’s usage?
What are PE(Portable Executable)?
Is an interface a type c#?
What is datasource c#?
What is the use of list in c#?
What is continue in c#?
What is an enumerator in c#?
How do I format a string in c#?
Can we have multiple threads in one app domain?
Why do we use readonly in c#?
What is meant by unicode characters?
Explain the difference between a Private Assembly and a Shared Assembly