Monday, June 16, 2014

Program To Check Neon number Using C Language


What is neon number:


A neon number is that where sum of digits of square of the number is equal to the number.
For example if the input number is 9, it's square is 9*9 = 81 and sum of the digits is 9. 9 is a neon number


C Program to check neon number


#include< stdio.h >
void main()
{
 int n,sq,i,sum=0;
clrscr();
printf("Enter the number:");
scanf("%d",&n);
sq=n*n;
for(i=sq;i>0;i=i/10)
sum=sum+i%10;
if(sum==n)
printf("%d is a neon number.",n);
else
printf("%d is not a neon number.",n);
getch();
}

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner