Thursday, June 13, 2013

C program to find Armstrong number

C program for finding Armstrong numbers

#include<stdio.h>
int main(){
    int num,r,sum=0,temp;

    printf("Enter a number: ");
    scanf("%d",&num);

    temp=num;
    while(num!=0){
         r=num%10;
         num=num/10;
         sum=sum+(r*r*r);
    }
    if(sum==temp)
         printf("%d is an Armstrong number",temp);
    else
         printf("%d is not an Armstrong number",temp);

    return 0;
}




output:
Enter a number: 153
153 is an Armstrong number


--------------------------------------------------
  • Warp to check a number is Armstrong
  • C program to check whether a number is Armstrong or not
  • Simple c program for Armstrong number
  • Armstrong number in c with output
  • Write a c program for Armstrong number
  • C program for Armstrong number generation
  • How to find Armstrong number in c
  • Code for Armstrong number in c
  • C program to print Armstrong numbers from 1 to 500
  • C program for finding Armstrong numbers
  • Armstrong number c program
  • C program to generate and print armstrong numbers
  • C Program to Find whether Number is a Armstrong Number
  • C program to find Armstrong number

No comments:

Post a Comment