Skip to content

sankar157515/amstrong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

amstrong

#include <stdio.h> int main() { int num, originalNum, remainder, result = 0; printf("Enter a three-digit integer: "); scanf("%d", &num); originalNum = num;

while (originalNum != 0) {
   // remainder contains the last digit
    remainder = originalNum % 10;
    
   result += remainder * remainder * remainder;
    
   // removing last digit from the orignal number
   originalNum /= 10;
}

if (result == num)
    printf("%d is an Armstrong number.", num);
else
    printf("%d is not an Armstrong number.", num);

return 0;

}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published