coderz.py

Keep Coding Keep Cheering!

Check for palindrome number

A palindrome number is a number that remains the same when digits are reversed. For example, the number 125521 is a palindrome number, but 1451 is not. Program Logic: First, Declare a variable reverseNum and initialize it with 0. Now, make a while loop till the original number is greater than zero. In every loop, get the last digit […]

November 12, 2022 | C++ | No comments

Find Max Number Among the Given Three Number Using If/Else Statements

n1 is compared to n2. If n1 is larger than n2, it is compared to n3. If it is greater than n3 as well, n1 is the max number; otherwise, n3 is the max number. If n1 is not greater than n2, it follows that n2 is greater than n1. After that, n2 is compared to n3. […]

November 11, 2022 | C++ | No comments

Check for Prime number

A prime number is greater than one and can be divided by one or itself. In other words, prime numbers cannot be divided by anything other than themselves or 1. Prime numbers include 2, 3, 5, 7, 11, 13, 17, 19, 23, etc. Program code: Output: Note: also read about Diamond Pattern Using Numbers Follow Me […]

November 11, 2022 | C++ | No comments

Pascals triangle

Pascals triangle is a triangular array of binomial coefficients. The numbers outside Pascals triangle are all “0”. These “0s” are very important for the triangular pattern to work to form a triangular array. The triangle starts with a number “1” above, and any new number added below the upper number “1” is just the sum […]

November 8, 2022 | C++ | No comments

Sum Of Series 1 + 2 + 4 + 8 + 16 + 32 + . . n

Program code: Output: Main Logic used here: Note: also read about Sum Of Series 1 + 2 + 3 + 4 + 5 + 6 . . . . n Follow Me Please follow me to read my latest post on programming and technology if you like my post. https://www.instagram.com/coderz.py/ https://www.facebook.com/coderz.py Rabecca FatimaStaying up to the […]

November 5, 2022 | C++ | No comments

Sum Of Series 1 + 1 / 2 ^ 2 +. . . . 1 / n ^ n

A program to compute the sum of a given series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n. For this, we will be given the value of n, and our task will be to add up each term, beginning with the first, to find the sum of the given series. Program code: Output: Note: also […]

November 5, 2022 | C++ | No comments

Sum Of Series 1 + 2 + 3 + 4 + 5 + 6 . . . . n

The sum of a series consisting of n terms beginning with “1,” is equivalent to the sum of n natural numbers beginning with 1. There are numerous approaches to solving the same problem, but the ones listed below are the most commonly used by coders. Program code: Output: As one can see in the above code, […]

November 5, 2022 | C++ | No comments

Program to Find ASCII Value of a Character

In C++ programming, a character variable stores an ASCII value (an integer number between 0 and 127) rather than the character itself. This is known as the ASCII value. For instance, the ASCII value of ‘A’ is 65. Therefore, to find the ASCII value of the given Character, we make use of the concept of Type-Casting. […]

November 5, 2022 | C++ | No comments

Even Or Odd number check

A number is even if it is divisible by two, and odd if it is not divisible by two. Some of the even numbers are − Some of the odd numbers are − program code: Output: In the code, we use the if-else block to determine whether the entered number is even or odd. Note: also […]

November 5, 2022 | C++ | No comments

Adding two numbers

Program code: Output: where, int sum=0: A variable can be initialized during the declaration process. This is usually done to ensure that the value to be used in the future is not set to some random value at the start. sum = x + y: The addition operation is performed by this statement. Note: also […]

November 5, 2022 | C++ | No comments

Advertisement