-
-
Save amankharwal/048b204b00b18458fda6c7906980f9fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(){ | |
int i, hundred, tens, ones, counter, number, count; | |
for (i = 1; i<=500; i++){ | |
hundred = i/100; | |
counter = i % 100; | |
tens = counter/10; | |
ones = counter % 10; | |
count = ((hundred*hundred*hundred)+(tens*tens*tens)+(ones*ones*ones)); | |
if (count == i){ | |
cout<<"Armstrong Number Between 0 and 500: "<<i<<endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment