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
What is tpl in c#?
In a single .NET DLL how many classes it contains?
How long has c# been around?
What is difference between c and c sharp?
What is a method signature c#?
What is different about switch statements in c#?
Which is the base class in c#?
What is the use of flag in c#?
What is the difference between Static, Const and read only?
What are the differences between events and delegates in c#?
What is the do while loop code?
What is string programming language?
What are callback methods in c#?
Explain how to implement delegates in c#.net
What is difference between var dynamic and object in c#?