C++ Articles

Page 107 of 597

Program to find Cullen Number in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 184 Views

In this tutorial, we will be discussing a program to find Cullen Number.For this we will be provided with an integer. Our task is to find the cullen number at that position using the formula −2n* n + 1Example#include using namespace std; //finding the nth cullen number unsigned get_cullen(unsigned n){    return (1

Read More

Program to find equation of a plane passing through 3 points in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 490 Views

In this tutorial, we will be discussing a program to find equation of a plane passing through 3 points.For this we will be provided with 3 points. Our task is to find the equation of the plane consisting of or passing through those three given points.Example#include #include #include #include using namespace std; //finding the equation of plane void equation_plane(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3){    float a1 = x2 - x1;    float b1 = y2 - y1;    float c1 = z2 - z1; ...

Read More

Counting frequencies of array elements in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 16K+ Views

We are given an array of integer elements which contains duplicate values and the task is to calculate the frequencies of the distinct elements present in an array and print the result.Input − int arr[] = {1, 1, 2, 3, 4, 1, 2, 3}Output −frequency of 1 is: 3 frequency of 2 is: 2 frequency of 3 is: 2 Frequency of 4 is: 1Input − int arr[] = {2, 3, 4, 1, 5}Output −frequency of 1 is: 1 frequency of 2 is: 1 frequency of 3 is: 1 Frequency of 4 is: 1 Frequency of 5 is: 1Approach used in ...

Read More

Program to find first N Iccanobif Numbers in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 168 Views

In this tutorial, we will be discussing a program to find N lccanobif numbers.For this we will be provided with an integer. Our task is to find the lccanobif number at that position. They are similar to the fibonacci number except the fact that we add the previous two numbers after reversing their digits.Example#include using namespace std; //reversing the digits of a number int reverse_digits(int num){    int rev_num = 0;    while (num > 0) {       rev_num = rev_num * 10 + num % 10;       num = num / 10;    } ...

Read More

Count Uppercase, Lowercase, special character and numeric values in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 8K+ Views

We are given a string containing Uppercase letters, Lowercase letters, specials characters and number values also. The task is to calculate the frequency of all types of characters, special characters and numeric values in the string.Uppercase Letters − A - Z having ASCII values from 65 - 90 where, 65 and 90 are inclusive.Lowercase Letter − a - z having ASCII values from 97 - 122 where, 97 and 122 are inclusive.Numeric values − 0 - 9 having ASCII values from 48 - 57 where, 48 and 57 are inclusive.Special Characters − !, @, #, $, %, ^, &, *Input ...

Read More

Program to find GCD of floating point numbers in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 572 Views

In this tutorial, we will be discussing a program to find GCD of floating point numbers.For this we will be provided with two integers. Our task is to find the GCD (Greatest common divisor) of those two provided integers.Example#include using namespace std; //returning GCD of given numbers double gcd(double a, double b){    if (a < b)       return gcd(b, a);    if (fabs(b) < 0.001)       return a;    else       return (gcd(b, a - floor(a / b) * b)); } int main(){    double a = 1.20, b = 22.5;    cout

Read More

Count set bits in a range in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 436 Views

We are given an integer number let’s say, num and the range with left and right values. The task is to firstly calculate the binary digit of a number and then set the loop from the left digit till the right digit and then in the given range calculate the set bits.Set bits in a binary number is represented by 1. Whenever we calculate the binary number of an integer value then it is formed as the combination of 0’s and 1’s. So, the digit 1 is known as set bit in the terms of the computer.Input − int number ...

Read More

Program to find greater value between a^n and b^n in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 211 Views

In this tutorial, we will be discussing a program to find greater value between a^n and b^n.For this we will be provided with three numbers. Our task is to calculate a^n and b^n and return back the greater of those values.Example#include using namespace std; //finding the greater value void findGreater(int a, int b, int n){    if (!(n & 1)) {       a = abs(a);       b = abs(b);    }    if (a == b)       cout b)       cout

Read More

Count of parallelograms in a plane in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 301 Views

We are given a plane containing points forming the parallelogram and the task is to calculate the count of parallelograms that can be formed using the given points. In parallelograms opposite sides of a quadrilateral are parallel and therefore opposite angles are equal.Input −int a[] = {0, 2, 5, 5, 2, 5, 2, 5, 2} Int b[] = {0, 0, 1, 4, 3, 8, 7, 11, 10}Output − Count of parallelograms in a plane − 3Explanation − we are given with the (x, y) points and using these points we can form a count of 3 parallelograms as shown in ...

Read More

Maximum of smallest possible area that can get with exactly k cut of given rectangular in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 193 Views

In this tutorial, we will be discussing a program to find the maximum of smallest possible area that can get with exactly k cut of given rectangular.For this we will be provided with the sides of the rectangle and the number of cuts that can be made. Our task is to calculate the smallest area that can be achieved by making the given number of cuts.Example#include using namespace std; void max_area(int n, int m, int k) {    if (k > (n + m - 2))       cout

Read More
Showing 1061–1070 of 5,962 articles
« Prev 1 105 106 107 108 109 597 Next »
Advertisements