Skip to content

Instantly share code, notes, and snippets.

@uysalserkan
Created January 19, 2019 18:02
Show Gist options
  • Save uysalserkan/855a291d6634a6c28c4acf4c19e3f3ad to your computer and use it in GitHub Desktop.
Save uysalserkan/855a291d6634a6c28c4acf4c19e3f3ad to your computer and use it in GitHub Desktop.
The program find the armstrong numbers between 100 to 999
#include <iostream>
using namespace std;
void armstrong(int num);
int main(void){
int i;
for(i=100;i<999;i++)
armstrong(i);
}
void armstrong(int num){
int temp;
temp=num;
int i,j,k;
i=temp%10;
temp /=10;
j=temp%10;
temp /=10;
k=temp%10;
i=i*i*i;
j=j*j*j;
k=k*k*k;
if(i+j+k==num)
cout <<num<<" is armstrong number!"<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment