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


Please Help Members By Posting Answers For Below Questions

What is tpl in c#?

668


In a single .NET DLL how many classes it contains?

710


How long has c# been around?

743


What is difference between c and c sharp?

668


What is a method signature c#?

699


What is different about switch statements in c#?

649


Which is the base class in c#?

694


What is the use of flag in c#?

687


What is the difference between Static, Const and read only?

826


What are the differences between events and delegates in c#?

679


What is the do while loop code?

675


What is string programming language?

616


What are callback methods in c#?

692


Explain how to implement delegates in c#.net

691


What is difference between var dynamic and object in c#?

692