Saturday, 27 January 2018

c program to check weather number is neon or not

//program to check neon number
//By:-sujeet kumar
/*Neon number:-Sum of digit of square of any number should be equal to that number.

                e.g:- 1,9 etc
                9=9*9=81
                81=8+1=9*/

#include<stdio.h>
#include<conio.h>
void main()
{
    int n,sq,sum=0;
    printf("enter any number:");
    scanf("%d",&n);
    sq=n*n;
    while(sq>0)
    {
       sum=sum+sq%10;
       sq=sq/10;
    }
    if(sum==n)
        printf("\nNeon number");
    else
        printf("\nNot neon number");
    getch();
}

No comments:

Post a Comment

c program to print fibonacci series

//program to print fibonacci series //By:-sujeet kumar //0 1 1 2 3 5 8 ...... #include<stdio.h> #include<conio.h> void ma...