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 |
List down the differences between “dispose” and “finalize” methods in c#.
What's the difference between class and object?
What's the difference between abstraction and encapsulation?
Is string a data type in c#?
What is difference between asp net and c# net?
Explain the difference between object type and dynamic type variables in c#?
why C# called C#
How do you achieve polymorphism in c#?
What is the main purpose of linq?
Explain constructor?
How can we insert 100 records @ a time without using for loop into the databse
What does m mean in decimal 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)