C # about daffodils

Source: Internet
Author: User

[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 );
}
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.