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 |
Does c# support c type macros?
How many constructors can a class have c#?
What is class and object c#?
What is console application with example?
What is xaml in c#?
boxing means converting value type to reference type and unboxing means converting reference type to value type.why we need boxing and unboxing?
3 Answers General Mills, Value Labs,
What is xaml file in c#?
What is private virtual in C#?
What is Implicit conversion in C#?
What is func delegate in c#?
What?s the advantage of using System.Text.StringBuilder over System.String?
What is parallel foreach 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)