Armstrong Number in c


#include<stdio.h>
#include<conio.h>
void main()
{
	int n,t,s,r;
	clrscr();
	printf("\n Enter the Number :");
	scanf("%d",&n);
	t=n;
	s=0;
	while(n>0)
	{
		r=n%10;
		s=s+(r*r*r);
		n=n/10;
	}
	if(t==s)
	{
		printf("\n The given Number %d is An Amstrong Number",t);
	}
	else
	{
		printf("\n The Given Number %d is not an Amstrong Number",t);
	}
	getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming