Here we will write a program to check whether the number is a Perfect number C++. So, first lets start with what is a perfect number. What is a Perfect number: Perfect Number is a number in which sum of all its positive divisors excluding that number is equals to the number. For example: […]

## Program to convert Decimal to Octal in C++

Here we will write a program to convert Decimal to Octal in C++ programming language. First lets start with how to convert decimal to octal: Here is an example of using repeated division to convert 1792 decimal to octal: Decimal Number Operation Quotient Remainder Octal Result 1792 ÷ 8 = 224 0 0 224 ÷ […]

## Program to Solve Quadratic equation C++

Here we will a write a program to solve quadratic equation C++ programming language. Let’s first understand how to solve a quadratic equation: Let’s take the quadratic equation as: ax²+bx+c=0 How program works: Take the values for a, b and c (double type). if, a = b = 0 then invalid equation if b² -4ac < […]

## C++ Program to Find Even Odd number

Explanation: User enters a number, IF number is divisible by 2 i.e. if(number % 2==0), then number is even otherwise odd. Here is the program to find even odd number PROGRAM:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include <iostream> using namespace std; int main() { int number; cout << "Enter any integer: "; cin >> number; if(number % 2 ==0) cout << number << " is even number."; else cout << number <<" is odd number."; return 0; } |

OUTPUT:

## C++ Program to Check Palindrome Number

Explanation: User enters a number ‘n’. Save that number ‘n’ to ‘old_num’. Find reverse of ‘n’ by taking the remainder ‘num’ and add it to (num*10). Example: if remainder of 151 is 1 we make new number with remainder 1 multiplying it by 10 i.e. 1*10+1=11. And dividing ‘n’ by 10 while (n>0). Finally by […]

## Program to Print Fibonacci Series in C++

What is Fibonacci Series? In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence: or (often, in modern usage): (sequence A000045 in OEIS). By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of […]