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

Math notes

Supremum   math Logical math Recurrence Relation  

What is sequential flow chart?

These types of flow chart indicates that the flow of control normally passes from one instructions to the next in a sequence with in a programme. Example :- design a flow chart to calculate addition of two number                          

React Js interview questions