Greatest common factor problem Given two integers A less than B. Write code to find the greatest common divisor between A and B commonly known as GCD. What is a greatest common factor GCD(A, B) is the largest positive integer …

# Tag Archives: Cpp - Page 6

## Prime numbers list

List of prime numbers Write a C++ program to find the prime numbers between 100 and 10000 What is a prime number Definition: A number (N) is prime if it has no divisors except 1 and (N) Prime number calculator …

## Swap variables interview question

Swapping two variables without a temp Given two integer variables A and B. Write C++ code to swap them without using a temporary variable. Solution This is a well known problem for which you can find so many references on …

## Palindrome string program in C

Problem Write a C++ algorithm that takes a string as input then check if the input string is Palindrome. A Palindrome string reads the same from left to right and from right to left as in the following example: Rats …

## Reverse string in c++

Problem A typical interview question is to describe an algorithm to reverse a string of characters. Solution We need one pass through the characters of the string to get the string length or use a built in function to get …