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 the difference while using directive vs using statement ?

0 Answers  


Oops concepts ?

2 Answers   Accenture, Digital GlobalSoft,


What is ildasm.exe used for?

0 Answers  


What are properties in C#?

0 Answers   UGC Corporation,


How C# 4.0 supports dynamic programming language?

0 Answers  






What is difference between hashtable and dictionary in c#?

0 Answers  


What is an extension method in c#?

0 Answers  


How big is a float?

0 Answers  


How will you get the different language strings?

0 Answers  


Which is faster dictionary or hashtable?

0 Answers  


What is difference between field and property in c#?

0 Answers  


How do namespaces work?

0 Answers  


Categories