**The Program in C++ Program to Generate and show first 15 Narcissistic decimal numbers is given below:**

```
#include <iostream>
#include <cmath>
using namespace std;
bool isNarcissistic(int n) {
int len = log10(n) + 1;
int sum = 0, temp = n;
while (temp) {
int digit = temp % 10;
sum += pow(digit, len);
temp /= 10;
}
return (sum == n);
}
int main() {
int count = 0;
int num = 1;
cout << "Hello Codeauri Family,the first 15 Narcissistic decimal numbers are:" << endl;
while (count < 15) {
if (isNarcissistic(num)) {
cout << num << " ";
count++;
}
num++;
}
cout << endl;
return 0;
}
```

## Output:

Hello Codeauri Family,the first 15 Narcissistic decimal numbers are:

1 2 3 4 5 6 7 8 9 153 370 371 407 1634 8208

## Pro-Tips**💡**

This code defines a function called “isNarcissistic” that takes an integer as input, and returns true if the number is narcissistic and false otherwise. The function performs the following operations:

- Calculates the number of digits in the input integer.
- Extracts each digit from the input integer, raises it to the power of the number of digits, and adds the result to a sum.
- Returns true if the sum is equal to the input integer, and false otherwise.

The main function then prints the first 15 narcissistic decimal numbers by incrementing an integer (num) and

calling the “isNarcissistic” function on each iteration, counting and printing the numbers that are narcissistic until 15 are found.

**Learn C-Sharp ↗**

C-sharp covers every topic to learn about C-Sharp thoroughly.

**Learn C Programming ↗**

C-Programming covers every topic to learn about C-Sharp thoroughly.

**Learn C++ Programming↗**

**Learn C++ Programming↗**

C++ covers every topic to learn about C-Sharp thoroughly.