armstrong number

Solutions on MaxInterview for armstrong number by the best coders in the world

showing results for - "armstrong number"
Mika
06 Mar 2019
1sum of cubes of the digits
Matteo
22 Nov 2016
1temp=n;    
2while(n>0)    
3{    
4r=n%10;    
5sum=sum+(r*r*r);    
6n=n/10;    
7}    
8if(temp==sum)    
9printf("armstrong  number ");    
10else    
11printf("not armstrong number");    
12return 0;  
Francesco
30 Jan 2018
1#include<stdio.h>
2int main()
3{ 
4      int num ,n,n1,c=0,mul=1,sum=0,r,f,i;
5      printf("enter any num: \n");
6      scanf("%d",&num);
7      n=num;
8      n1=num;
9      while(n!=0)
10      {
11          r=n%10;
12          c++;
13          n=n/10;
14     }
15     while (num!=0)
16     {
17         f=num%10;
18         mul=1;
19         for(i=1;i<=c;i++)
20         {
21              mul=mul*f;
22         }
23
24        sum=sum+mul;
25       num=num/10;
26     }
27     if(n1==sum)
28         printf("Armstrong Number");
29    else
30         printf("Not an Armstrong Number");
31  return 0;
32}
Félix
30 Oct 2019
1// Armstrong Numbers
21, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748...
Cristina
30 Jul 2019
1  <form method="post">
2        Enter the Number:
3        <input type="number" name="number">
4        <input type="submit" value="Submit">
5    </form>
6    <?php
7    if ($_POST) {
8        //get the number entered  
9        $number = $_POST['number'];
10        //store entered number in a variable  
11        $a = $number;
12        $sum  = 0;
13        //run loop till the quotient is 0  
14        while ($a != 0) {
15            $rem   = $a % 10; //find reminder  
16            $sum   = $sum + ($rem * $rem * $rem) || $sum = $rem; //cube the reminder and add it to the sum variable till the loop ends  
17            $a   = $a / 10; //find quotient. if 0 then loop again  
18        }
19        //if the entered number and $sum value matches then it is an armstrong number  
20        if ($number == $sum) {
21            echo "Yes $number an Armstrong Number";
22        } else {
23            echo "$number is not an Armstrong Number";
24        }
25    }
26//here is another example using while loop
27
28$num=300;  
29$total=0;  
30$x=$num;  
31while($x!=0){  
32$rem=$x%10;  
33$total=$total+($rem*$rem*$rem);  
34$x=$x/10;  
35}  
36if($num==$total){
37  echo "Yes it is an Armstrong number";}
38else  
39{echo "No it is not an armstrong number";}  
queries leading to this page
how to check for amustorn number program carmstrong numbers 1634another example of armstrongarmstrong number algorithmcode the armstrong number the logicwhat are armstrong numbersarmstrong number code3 digit armstrong numberarmstrong examplearmstrong number in maththree digit armstrong numberhow to identify armstrong numbercheck whether a number is armstrong or not c programarm strong numberamstrong number in carmstrong numbers sequencearmstrong number example3 digit armstrong noarmstrong number listarmstrong numberarmstrong numbersprogram to find armstrong numberarmstrong numbers in 999armstrong 27s number definitionarmstrong number logicarmstrong number wikiarmstrong example data structureanother example of amstronghow to find amstrong numberangstrom number 3 digit numberhow to get the series of armstrong numberlist of armstrong numbershow to find the armstrong numberarmstrong number definitionarm strong numbersarmstrong numbers listamstrong numbersare all singel digit numbers armstrong numberswhat is an armstrong numberswhat is arm strong numbersarmstrong number findersimplified amstrong numbers listarmstrong logicarmstrong number of n digitsfind armstrong number write a program that takes an integer from the user and check whether input number is armstrong or not 28input range up to 500 29 an armstrong number is an n digit number that is equal to the sum of the nth powers of its digits 3 2a3 2a3 2b7 2a7 2a7 2b1 2a1 2a1 3d 371some armstrong numberswhat is armstrong number examplenext armstrong numberarmstrong phone numberuses of armstrong numbernumber which is armstrong and perfect numberarmstrong number without mod parentarmstring numberwhat is armstrong number in cwrite a c 2b 2b program using for loop to find whether the number is an armstrong number or not armstrong number excheckarmstrong 28 29amstring numbersarmstrong number serieshow to find the amstrong number using cwhat are the armstrong numberswhich is armstrong number 3famstrong number examplehow to check a armstrong number in carmstrong number algorithm in call armstrong numberswhich are armstrong numberarmstrong number 4 digitwap to check a given number is armstrong or not 3fis single digit amstrong numberhow to find a given no is armstrongarmstrong example with even number in itexamples of armstrong numbersprogram to find 4 digit armstrong numberwhere are armstrong numbers usedarmstrong numbers example10 armstrong numbersarmstrong coding in chow to find armstrong numberwhat is armstrong number definitionwhat is armstrong numbersexample of armstrong numberarmstrong number