we provide information about gadget news and price information and specs samsung, huawei, Tecno Price products, Specifications, Features and more information about software from blackberry and android

Friday, December 27, 2013

Program to Print Armstrong numbers in C#

Program to Print Armstrong numbers in C# - Did you know that every day there is always a new technology that is created? if you want to know please refer to the blog Gadget News well now we will discuss first about Program to Print Armstrong numbers in C# as you need now, we have compiled this article carefully, so please see to finish.

Articles : Program to Print Armstrong numbers in C#
full Link : Program to Print Armstrong numbers in C#
Article Csharp, Article programs,

You can also see our article on:


Program to Print Armstrong numbers in C#

C# Program to Print out all Armstrong numbers between 1 and 500

Program Statement:
Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = (1 * 1 * 1) + (5 * 5 * 5) + (3 * 3 * 3)

Solution:
 public class armstrong
{
int x, a, res, sum = 0;
public void find()
{
Console.WriteLine("\nAll Armstrong Numbers between 1 and 500 \n");
for (x = 1; x <= 500; x++)
{
a = x;
while (a != 0)
{
res = a % 10;
a = a / 10;
sum = sum + (res * res * res);
}
if (x == sum)
Console.Write(" {0} ", x);
sum = 0;
}
Console.WriteLine("\n");
}
}




article Program to Print Armstrong numbers in C# has been completed in the discussion

hopefully the information Program to Print Armstrong numbers in C# that we provide can be useful for you to know the development of technology in the present

articles Program to Print Armstrong numbers in C# we have conveyed to you, if feel this information is useful and you want to bookmark or share so that more people who know please use link https://profsmythe.blogspot.com/2013/12/program-to-print-armstrong-numbers-in-c.html.

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

Related : Program to Print Armstrong numbers in C#

0 comments:

Post a Comment