[Csharp] view plaincopy
/* (Start of program header annotation) </p> <p> * copyright and version Declaration of the program
* Copyright (c) 2011, a student from the computer College of Yantai University
* Author: Li Zhaoqing
* Completion date: January 1, September 9, 2012
* Input description:
* Problem description and output: Write a c # application to output all the daffodils.
* Knowledge expansion: the number of daffodils is only a kind of self-Power. Strictly speaking, the three power numbers of three numbers become the number of daffodils.
* Other-digit self-power names one-digit self-Power: one-digit number two-digit self-power number: no three-digit self-power number: daffodils number four-digit self-power number: four-leaf rose number five-digit self-Power: pentagram number six-digit self-Power: six-digit auto-Power: dipper number eight-digit self-power: eight Immortals nine-digit self-Power: nine Chongyang dozens of Self-Power: Ten perfect
* End the comment in the program Header
*/
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Namespace sxh
{
Class Program
{
Static void Main (string [] args)
{
Int I = 100;
Int d1, d2, and d3; // These are used to store the numbers corresponding to the input number, 10, and hundreds.
Console. WriteLine ("All daffodils :");
For (I = 100; I <1000; I ++)
{
D3 = I/100;
D2 = I % 100/10;
D1 = I % 10;
If (d1 * d1 * d1 + d2 * d2 * d2 + d3 * d3 * d3 = I)
{
Console. Write ("{0}", I );
}
Else
{
}
}
Console. ReadKey (false );
}
}
}