We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e0920e1 + 3139345 commit b8e83fbCopy full SHA for b8e83fb
C++/neon.cpp
@@ -0,0 +1,29 @@
1
+// C/C++ program to check and print
2
+// Neon Numbers upto 10000
3
+#include <iostream>
4
+using namespace std;
5
+#include <math.h>
6
+
7
+int checkNeon(int x)
8
+{
9
+ // storing the square of x
10
+ int sq = x * x;
11
12
+ // calculating the sum of digits
13
+ // of sq
14
+ int sum_digits = 0;
15
+ while (sq != 0) {
16
+ sum_digits = sum_digits + sq % 10;
17
+ sq = sq / 10;
18
+ }
19
+ return (sum_digits == x);
20
+}
21
22
+// Driver Code
23
+int main(void)
24
25
+ // Printing Neon Numbers upto 10000
26
+ for (int i = 1; i <= 10000; i++)
27
+ if (checkNeon(i))
28
+ cout << i << " ";
29
0 commit comments