Skip to main content

Write a program to print all armstrong number between 100 to 999.

Ans:-
#include<stdio.h>
main()
{
int num,n,rem;
int cube=0,sum;
printf("\n armstrong number between 100 and 999 are:");
for(num=100;num<=999;num++)
{
sum=0;
n=num;
do
{
rem=n%10;
cube=rem*rem*rem;
sum=sum+cube;
n=n/10;
}while(n>0);
if(num==sum)
{
printf("\n %d is armstrong number",num);
}
getch();
}
}

Comments

Popular posts from this blog

Important links

  Software Drive https://drive.google.com/drive/folders/1siws7oga-10wdlPhOdcjamlDH6wm0iE_?usp=sharing PPT Drive https://drive.google.com/drive/folders/1lNHhZ4_qlsyHrWA862DyBSvkF_J4YVp8 https://docs.google.com/document/d/1fo_4gFB4sgWfTBfZvK7qf0LP0y9ge1dH/edit

Python Practice questions

Reverse  Check substring in string  Armstrong no or not Palindrome  Table print  Power of the no Factorial