C Program to Check given number is Armstrong number or not

Q. Write a C Program to check given number is armstrong number or not

What is Armstrong Number?

– An Armstrong number is a number of three digits which is an integer such that sum of the cubes of its digits is equal to the number itself.

For example,

153 is an Armstrong number, i.e

= 13 + 53 + 33

=((1*1*1)+(5*5*5)+(3*3*3))

= 1 + 125 + 27

=153

Other armstrong numbers are 0, 1, 370, 407…

Source Code:

#include<stdio.h>
#include<conio.h>
void main()
{
	int no1,no2,rem,sum=0;
	clrscr();
	printf("ntEnter Number : ");
	scanf("%d",&no1);
	no2=no1;
	while(no1>0)
	{
		rem=no1%10;
		sum=sum+(rem*rem*rem);
		no1=no1/10;
	}
	if(sum==no2)
		printf("nntGiven number is Armstrong !");
	else
		printf("nntGiven number is Not Armstrong !");
	getch();
}

Output:

c program to check number is armstrong or not

Download Now (.Zip File)…

2 Comments

  1. prasad a. chitgopekar says:

    excellent !!!!!!
    it is very helpful for students ….

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.