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?



I want to single value if you give any integer value. Below are examples  1. Input: 123  Ou..

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

Post New Answer

More C Sharp Interview Questions

What is a delegate?

5 Answers   Siebel Systems,


What is thread pooling?

0 Answers  


What is system console writeline in c#?

0 Answers  


What is uint64_t?

0 Answers  


What is the difference between TypeOf, GetType and what are the uses of TypeOf, GetType.

2 Answers   Siemens, Syntel,


What is the difference between icomparer and icomparable in c#?

0 Answers  


What does args mean in c#?

0 Answers  


Which language is used for desktop application?

0 Answers  


How do I know if executenonquery is successful c#?

0 Answers  


What is the difference between first and firstordefault?

0 Answers  


What is global namespace in c#?

0 Answers  


What is the difference between int16 and int32 in c#?

0 Answers  


Categories