Neon Number solution using c language--programming_info problem 22

Neon Number:

#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int n, digit, sum =0;
 
    printf("Enter a number to check for neon Number \n");
 
    scanf("%d",&n);
    int sq = n*n;
 
    while(sq!=0){
        digit = sq % 10;
        sum += digit;
        sq = sq/10;
    }
 
    if(sum == n)
        printf("Neon Number \n");
    else
        printf("Not a Neon Number \n");
 
    return 0;
}

Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support