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 |
What is abstract class ?
What is sqldataadapter in c#?
What is the difference between c and c sharp?
For a combobox and a listbox same datatable given as a datasource. Now problem is that whenever focus of listbox changes selected value of combobox also get change or vice versa. what to be done to avoid this. According to requirement we cannot make different datasouce.
Can the accessibility of a type member be greater than the accessibility of its containing type?
Difference between debug.write and trace.write?
Can you mark static constructor with access modifiers?
Did it possible to cast a generic type of derived class to generic type of base class?
what is output parameter and parameter array?
What is the benefit of dependency injection c#?
Explain the use of virtual, sealed, override, and abstract method?
What is 8 bit signed integer?