armstrong numbers

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

showing results for - "armstrong numbers"
Melodie
18 Apr 2016
1int main(){
2    
3    int a;
4    cin >> a;
5    int check = a;
6    int sum = 0;
7    while(a!=0){
8        int rem = a%10;
9        sum += pow(rem,3);  //include cmath
10        a/=10;
11    }
12
13    if(sum==check){
14        cout << "armstrong";
15    } else {
16        cout << "not armstrong";
17    }
18    return 0;
19}
Lenny
11 Sep 2019
1sum of cubes of the digits
Ambrine
11 Jun 2019
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;  
Alan
18 Apr 2020
1#include <stdio.h>
2#include <stdlib.h>
3#include <math.h>
4
5int cube(int a)
6{
7    int c;
8    c =  a*a*a;
9    return c;
10}
11
12int armnum(int *a)
13{
14    int x = *a, n = 0, rem, r = 0;
15    while (x != 0) {
16        x /= 10;
17        n++;
18    }
19    x = *a;
20    while (x != 0) {
21        rem = x % 10;
22        r += cube(rem);
23        x /= 10;
24    }
25    if(r == *a){
26        return 1;
27    }
28}
29
30int main()
31{
32    int a, y;
33    scanf("%d", &a);
34    y = armnum(&a);
35    if(y == 1){
36        printf("It is an Armstrong number.");
37    }
38    else{
39        printf("It is not an Armstrong number.");
40    }
41}
Maximilian
18 Jul 2018
1Numbers -- Armstrong numbers
2Write a method that can check if a number is Armstrong  number
3 
4Solution:
5public  static  boolean ArmStrongNumber (int  num) {
6int a = 0,    b =0,    c= num;
7while(num>0){
8              a=num%10; 
9              num/=10; 
10              b=b+(a*a*a);
11}
12 
13if(c==b) {
14return true;
15}
16return false;
17}
Bailey
10 Sep 2019
1// Armstrong Numbers
21, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748...
queries leading to this page
armstrong number in chow to check armstrong number in carmstrong seriesarm strong numberhow to calqulate armstron nubers carmstrong numbersgenerate armstrong number in carmstrong numbers examplearmstrong number of n digitshow to find the armstrong numberarmstrong numbers in 999armstrong number using function in carmstrong logicc armstrong numberprogram to check armstrong number in carmstrong number algorithm in cwhich are armstrong numberhow to check for amustorn number program cc program to check the number is armstrong or notamstrong number in cc code for armstrong numberwhat is an armstrong numbersc programming armstrong numbercode the armstrong number the logicarmstrong example with even number in ithow to solve armstrong number in cwhere are armstrong numbers usedarmstrong number definitionfind armstrong number cc check for armostrong numbers without pow functionuses of armstrong numberc program to calculate armstrong numberhow to identify armstrong numberarmstrong number code in carmstrong numbers 1634find armstrong number in cwrite a sample code to check whether the given number is an armstrong number or nowhat is armstrong numbersc program that determine if a number entered is armstrong or not armstrongc program to check armstrong numberhow to find armstrong number of 5 digit number in carmstrong program in cwap to check whether the number is an armstrong number or not c program for armstrong10 armstrong numbersc program to find given number is armstrong or notarmstrong in ccode for armstrong number in carmstrong number in c with explanationprogram to check given number is armstrong or not in cwhat is a armstrong number in cwhat are armstrong numbersfour digit armstrong number c codewrite a c program armstrong numbernumber which is armstrong and perfect numberhow to get the series of armstrongwhich is armstrong number 3ffind armstrong number armstrong number logicarmstrong number findersome armstrong numbersprograming armstrong nubers in carmstrong number codearmstrong number c programc program armstrong numberarmstrong number examplehow to find the amstrong number using cwhat is armstrong number logic ccheckarmstrong 28 29check armstrong number in cmultiset to check if number is armstrongwrite a c prog to check armstrong numberwrite a program to find armstrong number in carmstrong number in c for any numberexamples of armstrong numbersexample of armstrong numbercheck armstrong no in carmstrong sequence in cwap to check a given number is armstrong or not 3farmstrong number serieswrite a code to check whether the given number is armstrong e2 80 99s number or notarmstrong number c codearmstrong number logic in chow to find armstrong numberwrite a c 2b 2b program using for loop to find whether the number is an armstrong number or not amstrong without using loopsimple c program to check armstrong numberint c 3d0 2ca 2ctemp 3b int n 3d153 3b 2f 2fit is the number to check armstrong temp 3dn 3b while 28n 3e0 29 7b a 3dn 2510 3b n 3dn 2f10 3b c 3dc 2b 28a 2aa 2aa 29 3b 7d if 28temp 3d 3dc 29 system out println 28 22armstrong number 22 29 3b else system out println 28 22not armstrong number 22 29 3b 7damstrong number exampleprogram simple c programs for armstrong numberarmstrong number in c using for looparmstrong number exarmstrong number 4 digitwrite a program to test whether an integer entered by the user is an armstrong number or not armstrong number listarmstrong number in c simple programall armstrong numbersarmstrong number find 4 digits 3farmstrong number simple program in cprogram to find given number is armstrong or not in carmstrong number in c explainedwrite 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 371armstrong examplearmstrong number program in c languae4 digit armstrong number in cwhat is armstrong number examplewhat is armstrong number in chow to find amstrong numberarmstrong phone numberprogram to print all armstrong numbers in cc program to find armstrong numberarmstrong numbers in c5 write a c program to check armstrong number c program to determine armstrong numberhow to get the series of armstrong numberwhat is armstrong number definitioncode to determine whether a number is an armstrong numberfinding a number is armstrong or not in cc program to find armstrong number in a rangecheck the number is armstrong or not ccheck whether a number is armstrong or not c programarmstrong coding in carmstrong 27s number definitionprint all armstrong number in chow to find a given no is armstrongfind armstrong in carmstrong series in carm strong numbersarmstrong number in c programizehow to generate armstrong numbers in carmstrong number algorithmhow to check a armstrong number in cwhat are the armstrong numbersc program for armstrong numberc program to check armstrong number using functionprogram to find 4 digit armstrong numberarmstrong number wikiarmstrong numbers sequencecode to check armstrong numverwrite a sample code to check whether the given number is an armstrong number or not armstrong number ccheck for armstrong number in carmstrong no in chow to find armstrong number in cprogram to find armstrong numberarmstrong number program in carmstrong numberarmstrong numbers