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 |
Is c# good for web development?
How can I get around scope problems in a try/catch?
What is the difference between String s(Small s) and String S(Capital S)?
How can you read 3rd line from a text file?
Can private virtual methods be overridden in c#.net?
Define property in c#.net?
What is Delegate and what is it used for ?
Why is hashset faster?
from web.config file with connection string who to interact means who to connect in gridview. in my system shows null something error what is the problem
What is ienumerable t in c#?
Why do we use threads in c#?
how to retrieve binary data from database (using c#.net and sql server/windows application)
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)