Given a decimal number as input, we need to write a program to convert the given decimal number into an equivalent binary number. Examples: Algorithm for Converting Decimal to Binary: Step 1: Divide the number by 2 and store the remainder in an array (modulus operator). Step 2: Divide the number by 2 using the […]
November 17, 2022 | C++ | No comments
Find the grade of the student based on the marks obtained in five subjects. Let the grade be calculated based on the following pattern: Average Mark Range Grade 91-100 A1 81-90 A2 71-80 B1 61-70 B2 51-60 C1 41-50 C2 33-40 D 21-32 E1 0-20 E2 To calculate a student’s grade based on total marks […]
November 17, 2022 | C++ | No comments
By using the + and – operators, we can swap two numbers without using a third variable. Main logic: Program code: Output: Note: also read about Check for palindrome number 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 12, 2022 | C++ | No comments
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
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
Program code: Output: Note: also read about Floyd’s Triangle 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 mark is what defines me. Hi all! I’m Rabecca Fatima a keen learner, great enthusiast, ready to take new challenges as […]
November 8, 2022 | C++ | No comments
Floyd’s triangle is a triangular array of natural numbers and it is named after Robert Floyd, a renowned computer scientist popularly known for the design of the Floyd–Warshall algorithm. Program code: Output: Note: also read about Pascals triangle. 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/ […]
November 8, 2022 | C++ | No comments
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
C++ programming using “*” for Christmas Tree Pattern Program code: Output: Note: also read about Pattern Program Using Star 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 mark is what defines me. Hi all! I’m Rabecca Fatima a […]
November 7, 2022 | C++ | No comments
In this program, we use numbers to generate a pyramid-like pattern. And numbers follow a pattern similar to this: 1 in the first line, 121 in the second line, 12321 in the third line, and so on. Program code: Output: Note: also read about Pattern Program Using Star Follow Me Please follow me to read my […]
November 7, 2022 | C++ | No comments