Republic Gadget, Windows Phone, Asansam box Version, Z3X BOX Samsung, How to Backup, iPhone 7 to PC/Mac, Korea Telecom

C# Program using Functions and loops

C# Program using Functions and loops - the world of technology is more advanced, we should be technically literate so as not left behind by others, in blogs Republic Gadget we will present updated information about technological developments, product reviews from various brands, now we will discuss first about this information C# Program using Functions and loops we cover directly from reliable sources, please see:

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 C# Program using Functions and loops

hopefully the infromation that we show for you about C# Program using Functions and loops can provide the latest knowledge about the gadgets you need in everyday life.

you've just read the article with the title C# Program using Functions and loops if you intend to bookmark or share it for many people please use the link https://bhrepublicadominicana.blogspot.com/2013/12/c-program-using-functions-and-loops.html still a lot of information on this blog, please visit other pages.

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

Related : C# Program using Functions and loops

0 komentar:

Post a Comment