 CPP All : Number Varieties and Crunches Concept Learning Code Sheets #### Checking for Armstrong Number (3 Digit) #1539

Program takes integer input and finds if given number is an armstrong number

#### Armstrong number n digit #1573

Checking for armstrong number which can be even more than 3 digit.

#### Check if number is a palindrome #1575

To check if given number is same even if reversed (Palindrome).

#### Reversing an integer #1579

Printing a positive integer in reverse form. for e.g. printing 123 as 321.

#### Check for perfect number #1582

Check if the sum of all the divisors of a number brings the number itself.

#### All factors (divisors) of a number #1584

Printing all factors or divisors of an integer number.

#### Check for prime number (1 and n exclusion technique) #1587

Check if a number has only two factors 1 and the number itself. The 1 and n exclusion technique does not test division with these two obvious divisors and does it for all other possible divisors.

#### Extracting and printing the first and last digit of a number #2119

Using a loop technique and successive division by 10 to extract first and last digit of a given number and then printing it.

#### Finding GCD/HCF of two integer numbers #2871

Program to find Highest Common Factor (HCF), also called the Greatest Common Divisor between the two numbers entered by the user.

#### Finding LCM/SCM of two integer numbers #2874

Program to find the Least Common Multiple (LCM), also called the smallest common multiple between the two numbers entered by the user.

#### Check if Perfect Square #2884

A program to check if the given integer by the user is a perfect square of some integer number.

#### Check if Perfect Square (double to int conversion method) #2888

A program to check if the given integer by the user is a perfect square of some integer number by using the square root of double to int conversion and then comparison method.

#### Check if Triangular Number (successive summation method) #2892

Find if the given number is a triangular number by successive summation of natural numbers until it matches the given number.

#### Check if Triangular Number (perfect square testing – without sqrt) #2897

Find if the given number is a triangular number by finding if the 8*n+1 is a perfect square without using the sqrt function of the math library

#### Check if Triangular Number (perfect square testing – using rounded sqrt) #2900

Find if the given number is a triangular number by finding if the 8*n+1 is a perfect square by using the rounded square root.

#### Check if Triangular Number (perfect square testing – double to int) #2907

Find if the given number is a triangular number by finding if the 8*n+1 is a perfect square by using the double to int conversion.

#### Checking for buzz number #3176

Test if a number is divisible by 7 or the last digit is 7, means whether the number is a buzz number.

#### Find prime factors of a number #3218

Finding prime factors of a number input by the user.

Solved Problems #### Palindrome numbers between 1 to 1000 #1553

Print all palindrome numbers between 1 to 1000.

Print all palindrome numbers between 1 to 1000.

#### Armstrong numbers between 1 to 999 #1566

Print all the armstrong numbers between 1 to 999.

Print all the armstrong numbers between 1 to 999.

#### Test palindrome for an integer number #3082

Write a program where a function of prototype int ispalin(int) is written, wh

Write a program where a function of prototype int ispalin(int) is written, which returns 1 when
given input number is a palindrome (eg. 121, 16561) else returns 0. Show implementation of this function in main routine by collecting a positive integer from the user.

#### function to reverse an integer #3086

Write a program to reverse the given integer number.using a separately called

Write a program to reverse the given integer number.using a separately called function to reverse the number.

#### Check if number is a palindrome without using modulus operator #3581

Write a C++ program to collect a positive integer from the user and the check

Write a C++ program to collect a positive integer from the user and the check its reversed number would be a palindrome or not (same number when reversed for e.g. 121, 1331). Please use some alternate technique to find remainder instead of modulus operator.

#### Error finding in function and related code #4447

Find syntactical errors in the following program and rewrite the program afte

Find syntactical errors in the following program and rewrite the program after underlining the corrected portion.

#include<iostreamh>
using namespace std;
void toUpper(char x) {return ((char) (x+1));}
main()
{
char c, String[]=”DOGS ARE NOT CATS”;
for(int i=0;String[i]!=;i++)
if(String[i]==’ ‘) cout<<endl;
else { c=toUpper(String[i]);cout<<c;}
return 0;
}

Code Sheets:18  Solved Problems:6
×