C++ Program to Check Whether a Given Number is Perfect Number

This is a C++ Program to Check if a Number is a Perfect Number. Problem Description The program intakes a number and checks if it is a perfect number or not. A perfect number is equal to the sum of its divisors excluding itself. Problem Solution 1. The number to be checked if it is … Read more

advertisement

C++ Program to Check Prime Number

Problem Description Write a C++ program to check if a given number is Prime number or not. What is Prime Number? A prime number is a natural number greater than 1 that can only be divided by 1 and itself without leaving a remainder. Examples of Prime Numbers: 2, 3, 5, 7, 11, 13, 17, … Read more

advertisement

C++ Program to Print Pascal Triangle

This C++ Program which prints pascal’s triangle. The program takes number of rows as input and uses nested loops to print pascal’s triangle. The first inner loop creates the indentation space and the second inner loop computes the value of binomial coefficient, creates indentation space and prints the binomial coefficient for that particular column. Here … Read more

advertisement

Factorial Program in C++

Problem Description We have to write a C++ program to find out the factorial of a given number with and without using recursion. What is Factorial Number? In mathematics, the factorial of a positive integer “n” (represented as “n!”) is the product of all positive integers less than or equal to “n”. The factorial can … Read more

advertisement

Fibonacci Series Program in C++

This C++ Program generates Fibonacci Series upto 1000. Here the first two numbers in the Fibonacci Series are 0 and 1 and the rest of the numbers are obtained by adding previous two numbers. Here is source code of the C++ program which generates Fibonacci Series upto 1000. The C++ program is successfully compiled and … Read more

advertisement

C++ Program to Find the GCD and LCM of N Numbers

This is a C++ Program to find GCD and LCM of given two numbers. Here is source code of the C++ Program to Find the GCD and LCM of n Numbers. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below. #include<iostream>#include<conio.h>#include<stdlib.h> using namespace std; int gcd(int x, … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.