Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created August 22, 2021 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/048b204b00b18458fda6c7906980f9fb to your computer and use it in GitHub Desktop.
Save amankharwal/048b204b00b18458fda6c7906980f9fb to your computer and use it in GitHub Desktop.
#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