Ask Question - Get Answer

1 Ans Write a C program to Find Armstrong Number series upto a Number

Asked by AL MaMun (4 Golds) Friday, 31 Jul 2020, 04:08 PM at (Education Tutorials)

Please log in to answer, like and save
0
Save 0

<<< Previous
Log in to Answer Next >>>

Answer(s):

A C Program to find Armstrong number series.

#include<stdio.h>

int check(int n)

{

    int temp, r, sum=0;

    temp=n;

    while(n!=0)

    {

        r=n%10;

        sum=sum+r*r*r;

        n=n/10;

    }

    if(temp==sum)

        return 1;

    else

        return 0;

}

int main()

{

    int i, upto, is;

    printf("Find Armstrong Number upto __ ? \n");

    scanf("%d", &upto);

    for(i=1; i<=upto; i++)

    {

        is=check(i);

        if(is==1)

            printf("%d ", i);

    }

    return 0;

}


Answered by AL MaMun (4 Golds) Friday, 31 Jul 2020, 04:09 PM

Please log in to Upvote, Downvote and Report
           

Related Q/A:

2 Ans Train Location Message TR Train_Code and Send to 16318 Example: TR 705 Send to 16318

1 Ans Write a C program to check a Prime number

1 Ans How to Learn HTML - HyperText Markup Language easily? 

3 Ans Three ways to find Greatest Common Divisor (GCD) and Least Common Multiple (LCM) in a C program

1 Ans Single Digit Interest Rate in the Banking Sector: Problems and Prospects - essay writing

2 Ans Write a C program for Binary Search algorithm

1 Ans Write a C++ program for BigMod math

1 Ans Write a C program to print Pascal Triangle

1 Ans Write a C Program to check Anagrams of two strings

1 Ans Write a C program to implement x power n using recursion