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 check Bubble sort data structure and algorithm

1 Ans Write a C program to print Fibonacci number series

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

1 Ans Write a C program to reverse a number

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

1 Ans Write a C program for Interest Calculation

3 Ans BPSC Assistant Programmer Lab Aptitude test Programs and Queries with Proper solution (Taken By BCC)

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

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 implement x power n using recursion