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 the difference while using directive vs using statement ?
Oops concepts ?
2 Answers Accenture, Digital GlobalSoft,
What is ildasm.exe used for?
What are properties in C#?
How C# 4.0 supports dynamic programming language?
What is difference between hashtable and dictionary in c#?
What is an extension method in c#?
How big is a float?
How will you get the different language strings?
Which is faster dictionary or hashtable?
What is difference between field and property in c#?
How do namespaces work?