Samual Sam has Published 2492 Articles

C++ Program to Find Factorial

Samual Sam

Samual Sam

Updated on 24-Jun-2020 07:33:15

21K+ Views

Factorial of a non-negative integer n is the product of all the positive integers that are less than or equal to n.For example: The factorial of 5 is 120.5! = 5 * 4 * 3 * 2 *1 5! = 120The factorial of an integer can be found using a ... Read More

C++ Program to Find GCD

Samual Sam

Samual Sam

Updated on 24-Jun-2020 07:31:44

13K+ Views

The Greatest Common Divisor (GCD) of two numbers is the largest number that divides both of them.For example: Let’s say we have two numbers are 45 and 27.45 = 5 * 3 * 3 27 = 3 * 3 * 3So, the GCD of 45 and 27 is 9.A program ... Read More

C++ Program to Reverse a Number

Samual Sam

Samual Sam

Updated on 24-Jun-2020 07:29:59

977 Views

Reversing a number means storing its digits in reverse order.For example: If the number is 6529, then 9256 is displayed in the output.A program to reverse a number is given as follows −Example Live Demo#include using namespace std; int main() {    int num = 63972, rev = 0;   ... Read More

C++ Program to Swap Two Numbers

Samual Sam

Samual Sam

Updated on 24-Jun-2020 07:26:57

2K+ Views

There are two ways to create a program to swap two numbers. One involves using a temp variable and the second way does not use a third variable. These are explained in detail as follows −Program to Swap Two Numbers using temp VariableThe program to swap two numbers using a ... Read More

C++ Program to Check Whether Number is Even or Odd

Samual Sam

Samual Sam

Updated on 24-Jun-2020 07:24:38

12K+ Views

A number is even if it is divisible by two and odd if it is not divisible by two.Some of the even numbers are −2, 4, 6, 8, 10, 12, 14, 16Some of the odd numbers are −1, 3, 5, 7, 9, 11, 13, 15, 17Check Whether Number is Even ... Read More

C++ Program to Find Largest Number Among Three Numbers

Samual Sam

Samual Sam

Updated on 24-Jun-2020 07:22:40

4K+ Views

The largest number among three numbers can be found using if statement multiple times. This is given in a program as follows −Example Live Demo#include using namespace std; int main() {    int a = 5 ,b = 1 ,c = 9;    if(a>b) {       if(a>c)       cout

C++ Program to Check Whether a Number is Prime or Not

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:36:59

3K+ Views

A prime number is a whole number that is greater than one and the only factors of a prime number should be one and itself. Some of the first prime numbers are −2, 3, 5, 7, 11, 13 ,17The program to check if a number is prime or not is ... Read More

C++ Program To Convert Decimal Number to Binary

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:35:30

4K+ Views

In a computer system, the binary number is expressed in the binary numeral system while the decimal number is in the decimal numeral system. The binary number is in base 2 while the decimal number is in base 10. Examples of decimal numbers and their corresponding binary numbers are as ... Read More

C++ Program to Find Quotient and Remainder

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:30:27

9K+ Views

Quotient and Remainder are parts of division along with dividend and divisor.The number which we divide is known as the dividend. The number which divides the dividend is known as the divisor. The result obtained after the division is known as the quotient and the number left over is the ... Read More

C++ Program to Display Fibonacci Series

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:24:22

14K+ Views

The fibonacci series contains numbers in which each term is the sum of the previous two terms. This creates the following integer sequence −0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377…….The recurrence relation that defines the fibonacci numbers is as follows −F(n) = ... Read More

Advertisements