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 asp net in c#?
What is the implicit name of the parameter that gets passed into the set method/property of a class?
What is the use of properties window?
Are structs faster than classes?
What is multithreading with .net?
How do you escape c#?
What are the steps for creating clr trigger
How to print labels in windows form in C# .net
What is the use of console application in c#?
What is executenonquery c#?
What?s the top .NET class that everything is derived from?
Why can't we use a static class instead of singleton?
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)