Category Archives: 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 »

C Program to Check Vowel or Consonant

In this article, you will learn to check whether an alphabet entered by the user is a vowel or a consonant. English alphabets a, e, i, o and u both lowercase and uppercase are known as vowels. Alphabets other than vowels are known as consonants. We check whether given character matches any of the 5 vowels. If yes,… Read More »

C Program to check Leap Year (2 ways)

This program checks whether the input year is leap year or not. A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400. Leap Year : If a year is divisible by 4, 100 and 400 then it… Read More »