# C++ Program to Find Abundant Numbers Between Two Numbers

The Program in C++ Program to Find Abundant Numbers between two numbers is given below:

``````#include <iostream>

// Function to find the sum of proper divisors of a number
int sumOfProperDivisors(int num) {
int sum = 0;
for (int i = 1; i < num; i++) {
if (num % i == 0) sum += i;
}
return sum;
}

// Function to check if a number is abundant
bool isAbundant(int num) {
return sumOfProperDivisors(num) > num;
}

int main() {
int start, end;
std::cout << "Hello Codeuari Family,enter the start and end numbers here to find the abundant numbers between them: ";
std::cin >> start >> end;

// Find and display the abundant numbers between start and end
std::cout << "Okay, the abundant numbers between " << start << " and " << end << " are: ";
for (int i = start; i <= end; i++) {
if (isAbundant(i)) std::cout << i << " ";
}
std::cout << std::endl;

return 0;
}
``````

## Output:

Hello Codeuari Family,enter the start and end numbers here to find the abundant numbers between them: 1
1000
Okay, the abundant numbers between 1 and 1000 are: 12 18 20 24 30 36 40 42 48 54 56 60 66 70 72 78 80 84 88 90 96 100 102 104 108 112 114 120 126 132 138 140 144 150 156 160 162 168 174 176 180 186 192 196 198 200 204 208 210 216 220 222 224 228 234 240 246 252 258 260 264 270 272 276 280 282 288 294 300 304 306 308 312 318 320 324 330 336 340 342 348 350 352 354 360 364 366 368 372 378 380 384 390 392 396 400 402 408 414 416 420 426 432 438 440 444 448 450 456 460 462 464 468 474 476 480 486 490 492 498 500 504 510 516 520 522 528 532 534 540 544 546 550 552 558 560 564 570 572 576 580 582 588 594 600 606 608 612 616 618 620 624 630 636 640 642 644 648 650 654 660 666 672 678 680 684 690 696 700 702 704 708 714 720 726 728 732 736 738 740 744 748 750 756 760 762 768 770 774 780 784 786 792 798 800 804 810 812 816 820 822 828 832 834 836 840 846 852 858 860 864 868 870 876 880 882 888 894 896 900 906 910 912 918 920 924 928 930 936 940 942 945 948 952 954 960 966 968 972 978 980 984 990 992 996 1000

## Pro-Tips💡

The program takes two numbers as input, and uses a `for` loop to find and display all the abundant numbers between these two numbers, inclusive.

The is Abundant the function takes a number as input and returns `true` if it is an abundant number and `false` otherwise.

The function uses the `sumOfProperDivisors` function to calculate the sum of the proper divisors of the number and returns `true` if the sum is greater than the number, and `false` otherwise.

### 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↗

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

Codeauri is Code Learning Hub and Community for every Coder to learn Coding by navigating Structurally from Basic Programming to Front-End Development, Back-End Development to Database, and many more.

## C# Program to Find Sum of Rows & Columns of a Matrix

The Program in C# Program to Find Sum of Rows & Columns of a Matrix is given below: Output: Hello Codeauri Family,enter the number of rows and columns…

## C# Program to Calculate Determinant of Given Matrix

The Program in C# Program to Calculate Determinant of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns of the matrix…

## C# Program to Find Sum of right Diagonals of a Matrix

The Program in C# Program to Find Sum of right Diagonals of a Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns…

## C# Program to Find Transpose of Given Matrix

The Program in C# Program to Find Transpose of Given Matrix is given below: Output: Hello Codeauri Family, enter the number of rows and columns in the matrix:22Enter…

## C# Program for Multiplication of two square Matrices

The Program in C# Program for Multiplication of two square Matrices is given below: Output: Hello Codeauri Family, enter the number of rows/columns in the matrices:2Enter the elements…

## C# Program to Delete Element at Desired position From Array

The Program in C# Program to Delete Element at Desired position From Array is given below: Output: Hello Codeauri Family, enter the number of elements in the array:4Enter…

Your Journey into Code Begins Now: Discover the Wonders of Basic Programming

X