Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how to use an extender provider in the project.

978


in object oriented programming, how would you describe encapsulation?

1041


What are the benefits of using windows services:

1045


What is the use of base keyword? Tell me a practical example for base keyword’s usage?

926


What are PE(Portable Executable)?

1065


Is an interface a type c#?

961


What is datasource c#?

908


What is the use of list in c#?

856


What is continue in c#?

997


What is an enumerator in c#?

973


How do I format a string in c#?

858


Can we have multiple threads in one app domain?

951


Why do we use readonly in c#?

924


What is meant by unicode characters?

999


Explain the difference between a Private Assembly and a Shared Assembly

979