Sunidhi Bansal has Published 888 Articles

Recursive program to print formula for GCD of n integers in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 08:29:54

260 Views

We are given an integer as input. The goal is to print the formula of GCD of n numbers using recursion.We know that the GCD of three numbers say a1, b1 and c1 will be gcd(a1, gcd(b1, c1)).Similarly for more than three numbers, gcd can be obtained by formula as ... Read More

Recursive program to check if number is palindrome or not in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 08:28:12

6K+ Views

We are given an integer as input. The goal is to find whether the input number Num is a palindrome or not using recursion.To check if a number is palindrome, reverse that number and check if both numbers are the same or not. If the reversed number is equal to ... Read More

Recursive program for prime number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 08:26:06

6K+ Views

We are given an integer as input. The goal is to find whether the input number Num is a prime or non-prime using recursion.To check if a number is prime or not, start traversing from i=2 to i

Recursive Implementation of atoi() in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 08:20:05

2K+ Views

We are given a string containing a number. The goal is to find the equivalent number using the recursive atoi() method. int atoi(const char *str) converts the string argument str to an integer (type int).Example-:Input − Str[] = "58325"Output − The Equivalent decimal is :58325Explanation − The string contains the equivalent number 58325Input − ... Read More

Recursive function to check if a string is palindrome in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 08:09:17

7K+ Views

We are given a string Str as input. The goal is to find if the input string is a palindrome word or not using a recursive function. Palindrome strings are those strings that when read from front or end form the same word. The strings of length 0 are considered ... Read More

Rearrange the given source code in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 07:37:58

433 Views

We are given a string type variable, let's say, str which will be used to store the source code then calculate the size of the string and pass it to the function. The task is to rearrange the given source code and then print the result.Let us see various input ... Read More

Rearrange the string to maximize the number of palindromic substrings in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 07:15:32

369 Views

We are given with a string ‘str’ of any given length. The task is to rearrange the characters in such a manner that there will be maximum substrings that will be a palindrome string without adding or removing a character from the given input string. Palindrome string is the one ... Read More

Rearrangement of a number which is also divisible by it in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 07:13:10

419 Views

We are given an integer type number, let's say, number. The task is to rearrange number digit’s in such a manner that a number formed after rearrangement is also divisible by the given number i.e. ’number’.Let us see various input output scenarios for this −Input − int number = 100035Output − Rearrangement ... Read More

Rearrange characters to form palindrome if possible in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 07:09:53

1K+ Views

We are given with a string ‘str’ of any given length. The task is to rearrange the characters in such a manner that the output will be a palindrome string without adding or removing a character from the given input string. Palindrome string is the one in which the characters ... Read More

Rearrange Odd and Even values in Alternate Fashion in Ascending Order in C+=+

Sunidhi Bansal

Sunidhi Bansal

Updated on 02-Nov-2021 07:06:34

2K+ Views

We are given an integer type array containing both positive and negative numbers, let's say, arr[] of any given size. The task is to rearrange an array in such a manner that when the lowest element in an array is odd then elements of an array will be rearranged in ... Read More

Previous 1 ... 4 5 6 7 8 ... 89 Next
Advertisements