Tech News World, Contacts Samsung Galaxy, Windows 8, Nokia Lumia, Quad Core Smart Phones, HTC smartphone, Google Nexus, MacBook, PayPal

Monday, December 30, 2013

C# Program using Functions and loops

C# Program using Functions and loops - Although I work in the office and a lot of work that makes me tired but still I make a blog Tech News World and still will update it for you because this is part of my hobby who likes the world of technology, especially about the gadget, now we will discuss first about C# Program using Functions and loops because it is the topic that you are now looking for, please refer to the information I provide in the guarantee for you,

Articles : C# Program using Functions and loops
full Link : C# Program using Functions and loops
Article Csharp, Article programs,

You can also see our article on:


C# Program using Functions and loops

C# Program using Functions

Program Statement:
Write a function which takes one value as parameter and display the sum of digits in the value. e.g. if user has passed 125 then function will print 1+2+5 = 7

Solution:
 class _sum
{
long n, i, sum = 0;
public void add(long n)
{
for (i = n; i != 0; i = i / 10)
{
sum = sum + i % 10;

}
Console.WriteLine("\n\t\tSum of digits is : {0}", sum);
}
public void input()
{
Console.Write("\n\t\tEnter desired digit : ");
n = Convert.ToInt64(System.Console.ReadLine());
add(n);
}

}




so much information about C# Program using Functions and loops

hopefully information C# Program using Functions and loops can provide useful knowledge for you in getting information about the latest gadgets,

just finished your reading article about C# Program using Functions and loops if you feel this article useful for you please bookmark or share using link http://aziin5teens.blogspot.com/2013/12/c-program-using-functions-and-loops.html for more people know

Tag : , ,
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : C# Program using Functions and loops

0 comments:

Post a Comment