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
Why cannot you specify the accessibility modifier for methods inside the interface?
Can you put two constructor with the same structure in a class?
What is difference between dynamic and var in c#?
In a C# class we have a SortedList member m_addinProjects
we want to provide an iterator to allow the consumer of
this class access to the items in the collection. Please
provide an iterator method for the AnalyzeAddinsDLL class
below and an example of how it would be used.
namespace AnalyzeAddinsDLL
{
public class AllAddInProjects
{
private SortedList
What are functions in c#?
How can it prevents DLL Hell assembly versioning in .NET?
Explain the features of an abstract class in net.
Why do we need constructor in c#?
Explain use of abstract and sealed classes in c#?
What is type checking in c#?
What is an icollection in c#?
What can you do as a .net developer?
How many bits is int32?
Difference between debug.write and trace.write?
Enlist some of the properties of a thread class?