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 |
To create a localized application which namespaces are necessary?
What?s a delegate?
Which is faster list or dictionary in c#?
Describe the types of comments in c#?
What is delegation in oops?
What is the c# equivalent of c++ catch (...), Which was a catch-all statement for any possible exception?
What is static and use of it?
What is the difference between ref & out parameters?
Can we have static indexer in c#?
What's the difference between System.String and System..StringBuilder in C#?
How do you escape a character?
What is datatable in c#?