C++ Program to Display Current Date and Time

This C++ program prints the current date and time. The program uses the time library where a time_t structure is initialized to current date and time. The various members of the structure, i.e. current date, day in week, month and year, etc. can be accessed and the date can be printed in any format. The … Read more

advertisement

Sum of Digits Program in C++

This C++ Program which gets a number from input and displays the sum of the digits in the given number. The program uses a while loop to go through each and every digit of the given number and adds them up in the loop. Here is source code of the C++ program which gets a … Read more

advertisement

C++ Program to Reverse a Number

In C++, to reverse a number means swapping the digit at the last position with the digit at the first position and vice versa. Problem Description Write a C++ program to find the reverse of the number using for loop, while loop anf function. Problem Solution 1. The program takes an integer number. 2. Using … Read more

advertisement

C++ Program to Display Factors of a Number

This C++ Program which displays the factors of the given number. The program takes number from the input and runs a while loop until the temporary variable reaches the given number. The temporary number is printed on the screen if the given number is completely divisible by the temporary variable. Here is source code of … Read more

advertisement

C program to Check Whether a Number is Positive or Negative

This is a C++ Program to Check if a Number is Positive or Negative. Problem Description The program takes a number and checks if it is a positive number or negative number. Problem Solution 1. The program takes a number. 2. It is checked if it is positive or negative. 3. The result is printed. … Read more

advertisement

C++ Program to Check Whether a Number is Even

This is a C++ Program to Check if a Number is Even. Problem Description The program checks if an entered number is even or not. Problem Solution 1. The program takes a number and stores it. 2. If the entered number is divisible by 2, then it is even. 3. Else the number is not … Read more

advertisement

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

This C+ +Program checks if a given integer is odd or even. Here if a given number is divisible by 2 with the remainder 0 then the number is even number. If the number is not divisible by 2 then that number will be odd number. Here is source code of the C++ program which … Read more

advertisement

C++ Program to Print Armstrong Number between 1 to 1000

This C++ program prints all the armstrong numbers upto 1000. Armstrong numbers are those numbers whose value is equal to the sum of digits of the number to their third power. The nested loop are used for this purpose, where index of each loop is used as one digit of the number. The number is … Read more

advertisement

C++ Program to Check Armstrong Number

Problem Description Write a C++ program to check if a number is an Armstrong number. If the number is an Armstrong number, display ‘It is an Armstrong number’ otherwise, display ‘It is not an Armstrong number’. What is Armstrong number? An n-digit number such that the sum of each digit raised to the power n … Read more

advertisement

C++ Program to Check if a Number is an Adam Number

This is a C++ Program to Check if a Number is an Adam Number. Problem Description The program takes a number and checks if it is an Adam number. A number when squared, reversed, its root is found and is reversed again is equal to the original number, then it is called an Adam number. … 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.