Tag Archives: Cpp - Page 6

Greatest common factor calculator

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 …

Read more »

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 …

Read more »

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 …

Read more »

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 …

Read more »

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 …

Read more »

Page 6 of 6« First...23456