Menu


.

Write a program to know Armstrong number between certain range.

#include< iostream.h >

#include< conio.h >

void main()

{

clrscr();

int a,p,j,b,i,r;

cout<<"Enter any range";

cin>>a>>b;

cout<<"Armstrong nos are"<<endl;

for(i=a;i<=b;i++)

{

p=0;

for(j=i;j!=0;j=j/10)

{

r=j%10;

p=p+(r*r*r);

}

if(p==i)

cout<<i<<endl;

}

getch();

}




Enjoy our courses Today