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 |
Can a struct be null?
Why we use delegates in c#?
What?s the difference between an interface and abstract class?
What is foreach loop in c#?
Tell me the difference between call by value and call by reference.
Can list contain duplicates c#?
what is the purpose of new keyword while creating an object?
Why do we need indexer in c#?
What are namespaces, and how they are used?
What are the types of comment in c# with examples?
Explain the importance and use of each, version, culture and publickeytoken for an assembly.
What is difference between out and ref in c#?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)