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 Check whether two Strings are Anagrams

This is a C++ Program to Find if Two Strings are Anagrams. Problem Description The program takes two strings and checks if they are anagrams. An anagram is a phrase formed by rearranging the letters of a different phrase. Problem Solution 1. The program takes two strings. 2. Using a function, the two strings are … Read more

advertisement

C++ Program to Find Frequency and Position of Characters in a String

This is a C++ Program to Print Each Letter in a String followed by its Frequency. Problem Description The program takes a string and prints the frequency of each letter in the string. Problem Solution 1. The program takes a string. 2. The number of times a letter occurs in the string is recorded. 3. … Read more

advertisement

C++ Program to Remove Spaces from a String

This is a C++ Program to Remove the Spaces in a String. Problem Description The program takes a string and removes the spaces in it. Problem Solution 1. The program takes a string. 2. Using a for loop, any spaces found in the string are removed. 3. The result is printed. 4. Exit. C++ Program/Source … Read more

advertisement

C++ Program to Replace All Spaces in a String with %

This is a C++ Program to Replace all Spaces in a String with %. Problem Description The program takes a string and replaces all spaces in it with %. Problem Solution 1. The program takes a string. 2. The string is checked for spaces and replaced with %. 3. The result is printed. 4. Exit. … Read more

advertisement

C++ Program to Implement strchr() Function

This is a C++ Program to Implement the strchr() Function. Problem Description The program implements the function strchr() which takes a string and a character and returns a pointer to location of the latter in the string. Problem Solution 1. The program takes a string and a character. 2. Using a for loop, the character … 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.