Armstrong numbers between 1 to 999 – CSKC
Sign In

Search

Solved Problem #CPP#1566    siteicon   siteicon  

Problem Statement - Armstrong numbers between 1 to 999

Print all the armstrong numbers between 1 to 999.

Solution

TC++ #1566

 

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Notes

If you are required to print only 3 digit armstrong numbers, start the first while loop from 100.

If armstrong numbers of higher than 1000 are desired than pow(rem,digits) function of math.h has to be used in place ofย  num+=rem*rem*rem; Also number of digits have to be found before entering the second while loop.
Note: This question was deliberately asked from 1 to 999 as beyond 3 digits number this code won’t work.


Share

Created: 2-Dec-2017 12:51 | Updated: 13-Dec-2018 23:37|