Category Archives: C++ Programs

Tricky C++ programs

Programming has never been easier. Even though you may have mastered a particular programming language, there might still be some concepts that may make you dizzy on reading it. This article contains some set of tricky questions which may make you go dizzy. 1. Take a look at this terminated int main (); What will this program do?… Read More »

Nth number whose sum of digits is 10

Given, write a program that prints the Nth number whose sum of digits is 10. Examples: Input : 2 Output : 28 Explanation : the first number is 19, whose digit sum is 10. Input : 5 Output : 55 Explanation : the first four numbers whose digit sum is 10 are 19,28,37,46. Approach: In order to obtain… Read More »

Dangerous String

A string contains ‘0’ and ‘1’.You have to find out whether the string is dangerous or not. The string will be dangerous in the following two conditions. There are at least 7 continuous occurrences of ‘1’. There are at least 7 continuous occurrences of ‘0’. Examples: Input : 1000000001 Output : YES Explanation: It has more than 7… Read More »

Multiplication of two numbers in C++

In this article, we have discussed various methods to multiply two numbers in C++. These are simple program, you can learn them easily. Method-1 : With Hardcoded Inputs Output: 30 Method-2 : With user Inputs Output: Output depends on user inputs, that will be multiplication of both numbers. Method-3 : With class Output: Output depends on user inputs,… Read More »

Subtraction of two numbers in C++

In this article, we have discussed various methods to subtract two numbers in C++. These are simple program, you can learn them easily. Method-1 : With Hardcoded Inputs Output: -1 Method-2 : With user Inputs Output: Output depends on user inputs, that will be subtraction of both numbers. Method-3 : With class Output: Output depends on user inputs,… Read More »