What is the PHP code to display the first 1000 Armstrong number?

Asked by Last Modified  

1 Answer

Learn PHP

Follow 1
Answer

Please enter your answer

Software or Programming languages freelancer Trainer (BCA,Bcs, MCA)with 10+ experience

<html> <body> <!--totest thisscript type371or407,these are armstrong numbers--> <h2>Find Armstrong Number-PHP Script by<ahref="http://www.tutorialsmade.com/php-script-find-armstrong-number/">Tutorialsmade.com</a></h2> <form action=""method="post"> <input...
read more
<html> <body> <!--totest thisscript type371or407,these are armstrong numbers--> <h2>Find Armstrong Number-PHP Script by<ahref="http://www.tutorialsmade.com/php-script-find-armstrong-number/">Tutorialsmade.com</a></h2> <form action=""method="post"> <input type="text"name="number"/> <input type="submit"/> </form> </body> </html> <?php if($_POST) { //get the enter number $number=$_POST['number']; //store it in a temp variable $temp=$number; $sum=0; //loop till the quotient is 0 while($temp!=0) { $rem=$temp%10;//find reminder $sum=$sum+($rem*$rem*$rem);//cube the reminder and add it to the sum variable till the loop ends $temp=$temp/10;//find quotient. if 0 then loop again } //if the entered number and the $sum value matches then it is an armstrong number if($number==$sum) { echo"Armstrong Number"; }else { echo"Not an Armstrong Number"; } } ?> read less
Comments

Related Questions

PHP (LAMP) for entrepreneurs, is there any full time, fast track classes on PHP(LAMP) for entrepreneurs, who want are want to do some tech part in their startups
Yes, You have option. You can Join. Xpert Infotech, New Delhi. Before going through Silverlight live project training candidate should have knowledge of given concepts listed below: Knowledge of HTML...
Saee
0 0
6
how to place freshers job opening here?
Hello Rajesh, As an PHP aspirant you should be able to handle Basic HTML and CSS with hands on Javascript like putting together PHP and JS, Good expertise of Jquery like handling all DOM manipulations,...
Rajesh
Looking for Yii Framework experts who are willing to train.
A constructor is a special method of a class in object-oriented programming that initializes an object of that type. A constructor will have same name as the class, and can be used to set the values...
Pritam

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Read Your Gmail Emails Using PHP and IMAP
Hello Friends ,Recently I have worked on drip email campaign project for that I need to read emails using PHP From the gmail inbox. Here is the simple example for Read emails from the gmail: To start...

SQL Union Vs Union ALL
SQL UNION vs UNION ALL Operator Usage UNION: UNION combines the result set of two or more queries into a single result set. UNION removes duplicate records (where all columns in the results are the same). UNION...

SQL Tips (1 to 3)
SQL tip 1: Instead of Full Outer Join, you can use Union All. Difference is, Full Outer Join provides results side by side. Union All provides result s one by one. Note: MYSQL does not support Full...

Handbook of websites for Website Developers/Designers (software professionals)
Know the trending languages(past & present) and their comparision with other languages: @ https://www.tiobe.com/tiobe-index/ Found an interesting website? identify the technologies used to build...

Introduction to Programming Languages
What is a Programming Language? A programming language is a formal computer language or constructed language designed to communicate instructions to a machine, particularly a computer. Programming languages...

Recommended Articles

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Looking for PHP Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you