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:

1 Ans Write a C program to print Fibonacci number using recursion

2 Ans BPSC aptitude test all programs solutions here

2 Ans BPSC Programming Aptitude Lab Test Important programs

2 Ans Write a C program to implement Selection sort data structure and algorithm

1 Ans Which is the best and easy C programming learning website ?

1 Ans Write a C program to check a Palindrome Number

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 Write a C program to implement x power n using recursion

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