# C++ Programming Code Examples

## C++ > Mathematics Code Examples

This means a 'greatest number' which divides both numbers. Example: Two numbers are 18 and 24. Numbers which Divides both are 1, 2, 3 and 6 in which greatest number is 6. So 6 is

We already known that if reverse of a number is equal to the same number, it is Palindrome number. Remember it: certain variables and a loop use to get the reverse of a number which

For calculating the power of any number user have four possibilities to input values. Sample code only work for when we input +ve power, +ve 'base value', -ve base value. It is not work

In C++ coding, we take a 'For Loop' which will start from 1 up to number that has entered to check whether it is Prime Number or not with in for loop we set an 'IF' condition and placed

For example 6 is Perfect Number since divisor of 6 are 1, 2 and 3. Sum of its divisor is 1 + 2+ 3 =6 and 28 is also a 'Perfect Number' since 1+ 2 + 4 + 7 + 14= 28. Other 'Perfect Numbers': 496

To generate 'Armstrong numbers' in C++, you have to ask to the user to enter the interval to print the Armstrong number between a given interval as shown here in the following codes.

This is a program from numerical to calculate the 'root' of the given system, it will check its conditions and perform the operation on that system, esle it will tell you that system is not

To make a simple calculator in the C++, which performs basic four mathematical operations (addition, subtraction, multiplicatin, division) depending on the "user's choice", switch case

Use the three variable say a, b and c. Place b in a and c in b then place a+b in c to print the value of c to make and print Fibonacci series as shown here in the following C++ program.

For example, to print prime number between '3 to 29', here 3 is the starting number and 29 is the ending number, enter the starting and ending number to find and print all the prime

C++ Sample code Print first 100 "Ramanujan Numbers" by TWO WAYS 1st way is printing ramunajan numbers from RN taking RN from 0 to INFINITY & print first 100 numbers. 2nd

First think what is the factorial of a number? How 'mathematically' it can be calculated. If you got this info then it will be very easier to make a C++ code logic to find the "Factorial".

To reverse a number in C++, then you have to ask to the user to enter a number. Now, start reversing that number to find its reverse and then display its reverse on the screen. Make a

A 'prime number' is a natural number greater than 1 that has no positive divisors other than 1 and itself. The C++ Programming Language allows you to separate program-specific data

Page 1 Page 2 Page 3 Page 4 Page 5 Page 6