Learn about C Program to Find Neon Number in a Given Range in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
C Program to Find Neon Number in a Given Range
Program:
#include<stdio.h>
int main()
{
int m, n, i, sqr, j, sum;
printf("Enter The Range m and n Value(m<n): ");
scanf("%d %d",&m,&n);
printf("Neon Number from %d to %d are:\n",m,n);
for(i=m;i<=n;i++)
{
sum = 0;
sqr = i*i;
for( j=sqr ;j>0 ;j/=10 )
{
sum += (j%10);
}
if(sum == i)
printf("%d\t",i);
}
return 0;
}
Output:
Enter The Range m and n Value(m<n): 1 100
Neon Number from 1 to 100 are:
1 9
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
C Program to check Neon Number using for Loop
C Program to check Neon Number using While Loop