Found 26504 Articles for Server Side Programming

N-th root of a number in C++

Hafeezul Kareem
Updated on 22-Oct-2021 07:38:31

893 Views

You are given the N-th root and the result of it. You need to find the number such that numberN = result.Let's see some examples.Input result = 25 N = 2Output 5The 52 = 25. Hence the output in the above example is 5.Inputresult = 64 N = 3Output4 The 43 = 64. Hence the output in the above example is 4.AlgorithmImplementationFollowing is the implementation of the above algorithm in C++#include using namespace std; int getNthRoot(int result, int n) {    int i = 1;    while (true) {       if (pow(i, n) == result) {          return i;       }       i += 1;    } } int main() {    int result = 64, N = 6;    cout

N-th polite number in C++

Hafeezul Kareem
Updated on 22-Oct-2021 06:54:46

226 Views

A polite number is a positive number that can be written as the sum of 2 or more consecutive positive numbers.The series of polite numbers are3 5 6 7 9 10 11 12 13 14...There exists a formula to find the n-th polite number. The formula is n + log2(n + log2(n)). The default log computes with base e. We need to compute using base 2. Divide the default log result with log(2) to get the value of log with base e.AlgorithmAlgorithm to the n-th polite number is straightforward.Initialise the number N.Use the above formula to compute the n-th polite ... Read More

n-th number with digits in {0, 1, 2, 3, 4, 5} in C++

Hafeezul Kareem
Updated on 22-Oct-2021 06:33:37

344 Views

The numbers formed with the digits {0, 1, 2, 3, 4, 5} are0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, etc.., We can form the above sequence using the first 6 digits. Let's see an example of the formation of numbers. 1 * 10 + 0 = 10 1 * 10 + 1 = 11 1 * 10 + 2 = 12 1 * 10 + 3 = 13 1 * 10 + 4 = 14 1 * 10 + 5 = 15Similarly, apply for the number 2, 3, 4, ... Read More

n-th number whose sum of digits is ten in C++

Hafeezul Kareem
Updated on 22-Oct-2021 06:08:19

356 Views

The numbers whose digits sum is equal to 10 are19, 28, 37, 46, 55, 64, 73, 82, 91, etc.., If you observe the series, each number is incremented by 9. There are numbers in the above sequence whose digits sum does not equal 10 while incrementing by 9. But, you will get all the numbers whose digits sum is equal to 10.So, we can have a loop that increments by 9 and checks for digits sum and finds the n-th number. Let's see some examplesInputs 3 7Outputs 37 73AlgorithmInitialise the number nInitialise a counter to 0.Write a loop that iterates ... Read More

N-th multiple in sorted list of multiples of two numbers in C++

Hafeezul Kareem
Updated on 22-Oct-2021 05:54:52

213 Views

You are given three numbers. You need to find the n-th multiple from the multiples of the first two numbers. Let's see an example to understand it more clearly.Input x = 2 y = 3 n = 7Output 10The first n ****multiples of 2 are 2 4 6 8 10 12 14The first n ****multiples of 3 ****are 3 6 9 12 15 18 21If combine both multiples and sort them we get 2 3 4 6 8 9 10 12 14 15 18 21 and the nth number from the list is 10.AlgorithmInitialise a vector to store all the ... Read More

N digit numbers divisible by 5 formed from the M digits in C++

Hafeezul Kareem
Updated on 21-Oct-2021 12:57:36

200 Views

We have given a number N along with an array of M digits. Our job is to find the number of n digit numbers formed from the given M digits that are divisible by 5.Let's see some examples to understand the problem inputs and outputs.In − N = 2 M = 3 arr = {5, 6, 3}Out − 2There are 2 N digit numbers 35 and 65 possible that are divisible by 5. Let's see another example.Input − N = 1 M = 7 arr = {2, 3, 4, 5, 6, 7, 8}Output − 1There is only 1 number with ... Read More

Latin Square in C++

Hafeezul Kareem
Updated on 21-Oct-2021 09:12:56

559 Views

The Latin square is a matrix that has a special pattern. Let's see different examples to examine the pattern.1 2 2 1 1 2 3 3 1 2 2 3 1 1 2 3 4 4 1 2 3 3 4 1 2 2 3 4 1 The Latin square that you get will be of different size as you notice in the above examples. But, if you carefully observe the above matrices' pattern, you will find out that the last number of the previous row comes as the first element of the next row.That's the pattern ... Read More

How to Install Newman using NPM?

Debomita Bhattacharjee
Updated on 25-Jun-2021 13:39:59

2K+ Views

We can install Newman using npm. Newman can be installed using npm and Node.js. To download Node.js, navigate to the link − https://nodejs.org/en/download/current/.As we have downloaded Node.js successfully, we can check it with the below command −In Windowsnode --vIn Linuxnode --versionThe npm package becomes available automatically on installing Node.js. We can check it with the below command −In Windowsnpm --vIn Linuxnpm --versionFinally to install Newman, run the below command −For Windowsnewman --vFor Linuxnewman --version

How do you configure ASP.NET Core applications?

Akshay Khot
Updated on 22-Jun-2021 15:04:21

432 Views

During the development of an application, and even after it’s built, you often need to change various settings that control how the application behaves. Configuration refers to the external values that control an application's behavior, consisting of settings and parameters that the application uses at runtime.The best practice regarding storing configuration values is outside the application, instead of hard-coding them in the source code. You don’t want to recompile and restart the application every time you make a change to the configuration. There are also security implications. You don’t want to store the database connection strings or passwords in the ... Read More

Explain the ASP.NET Core support for multiple environments for development and production

Akshay Khot
Updated on 22-Jun-2021 15:10:35

1K+ Views

Running an application in production for live customers is very different from running it when you are developing it on your local machine. In production, your application is hosted on a server which has very different configurations and specifications than your computer. Various services that your application talks to, such as databases or external APIs change for production.By letting the application know which environment it’s running, you can vary the application’s behavior. ASP.NET Core makes it easy to manage various environments effortlessly. You can configure different configuration settings for different environments, and tweak them without having to recompile the application. ... Read More

Advertisements