Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + .. + n in C++

Revathi Satya
Updated on 16-May-2024 21:46:00

446 Views

In this article, we are given a number n that denotes the nth term of the series. Our task is to create a Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + .... + n in C++. This series is different from the other because it include terms that are repeated according to their values. The series 1 + 2 + 2 + 3 + 3 + 3 + … + n consists of repeated terms that are repeated infinitely only by their value. Such illustration 1 comes once, ’2 twice’, ... Read More

Maximum Sum Decreasing Subsequence in C++

Revathi Satya
Updated on 16-May-2024 20:07:51

172 Views

In this article, we are given an array arr[] of N integers. Our task is to find the Maximum Sum Decreasing Subsequence in C++. A Maximum Sum Decreasing Subsequence (MSDS) is a subsequence of a given sequence of array. Here the sequence elements are ordered in decreasing arrangement and the sum of these elements is the highest. Here, given a sequence of array a1, a2, …, an, the goal is to find a subsequence ai1, ai2, …, aik, where i1>i2>…>i1, such that we say the subsequence is ai1>ai2>…>aik (ordered in a decreasing order). The sequence of terms ai1+(ai2)...+(aik) is ... Read More

Maximum sum of distinct numbers with LCM as N in C++

Revathi Satya
Updated on 16-May-2024 19:59:34

186 Views

In this article, we are given a number N. Our task is to create a program to find the maximum sum of distinct numbers with LCM as N in C++. To achive this first of all we need to find the sum of maximum numbers that have N as the Lowest Common Multiple (LCM). For better understanding Let us go through 3 key concepts − Least Common Multiple (LCM): The lowest common multiple(LCM) of two or more integers is the smallest positive integer that is divisible for all of the integers. For example, the LCM of 4 and 5 ... Read More

Program to find smallest difference of angles of two parts of a given circle in C++

Revathi Satya
Updated on 16-May-2024 19:43:48

140 Views

In this article, we will find the smallest difference in angles between two parts of a given circle using the C++ programming language. Before proceeding to the code, let’s first understand how we can calculate the angles to find the smallest difference between them. We are given the angles of all the pieces of the circle in the array. We have to join the pieces in such a way that the angle difference between the two pieces is the least. Let's go through the input and output scenarios for better understanding − Input and Output Here, we declare an array ... Read More

Program to find sum of given sequence in C++

Revathi Satya
Updated on 16-May-2024 19:40:20

495 Views

In this article, we are given two numbers n and k representing a series. Our task is to create a program in C++ that finds the sum of the sequence given below: The input cycle is the process of adding up all the numbers in the given sequence to get a single output. The process of recursion is frequently used in mathematics and may be implemented with sequences namely the arithmetic ones ( each term is acquired by adding a constant difference between the previous one) and the geometric sequence ( where each term is multiplied by a constant ratio with the former term ... Read More

Program to find slope of a line in C++

Revathi Satya
Updated on 07-May-2024 14:53:38

784 Views

In this article, we will learn how to find the Slope of a line using a program. But before we proceed into the program, let's first understand what the Slope of a line represents in mathematics and how to compute it using its mathematics formula in C++. In mathematics, the Slope of a line is a numerical value that measures the line’s steepness and direction. It indicates the rate at which the line ups or down as you move along it from left to right (or horizontally). Generally, it is denoted by the letter "m". In mathematics, the steepness refers to the slope or gradient of a line. In terms of mathematical, ... Read More

Maximum sum and product of the M consecutive digits in a number in C++

Revathi Satya
Updated on 07-May-2024 14:53:30

161 Views

In this article, we are given a string representing a number. Our task is to create a program in C++ to find the maximum sum and product of M consecutive digits from the given number. We find all sequences of M consecutive digits and return the maximum sum and product. In mathematics, consecutive numbers are defined as those numbers that follow each other in increasing order from the smallest to the largest, with no missing numbers in between. This problem can be iterated through the string representation of the number, in other words, we consider consecutive segments of ... Read More

Program to find the common ratio of three numbers in C++

Revathi Satya
Updated on 07-May-2024 14:53:17

283 Views

In this article, Our task is to create a Program to find the common ratio of three numbers in C++. The common ratio of three numbers is usually the same ratio between two numbers multiplied by each other to get the next one. When a particular number of terms in progression or sequence are involved such as in the geometric progression, a common ratio can be easily found by dividing the term with the preceding term. For instance, if we have three numbers x, y, and z. then the common ratio r can be found as r = x:y = ... Read More

How Linux Uses Sockets?

Satish Kumar
Updated on 06-May-2024 11:39:55

343 Views

Introduction Linux is an open-source operating system that has gained immense popularity for its stability and security. It is widely used in various fields such as web servers, embedded systems, and supercomputers. One of the key aspects of Linux is its efficient usage of sockets for interprocess communication. Sockets provide a flexible way to establish communication channels between different processes running on the same or different machines connected over a network. What are Sockets? Sockets are a fundamental concept in Linux networking, allowing communication between processes on different computers over a network. In simple terms, a socket is an endpoint ... Read More

Types of Oil Circuit Breakers (OCBs)

Manish Kumar Saini
Updated on 06-May-2024 10:40:58

108 Views

Oil circuit breakers (OCBs) are used for performing the following two important functions - Switching of electric supply Protection of electrical system They are called oil circuit breakers because in this type of circuit breakers, insulating/dielectric oil is used for quenching the arc. In this article, we will learn about the basics of oil circuit breakers and their different types. What is an Oil Circuit Breaker? An oil circuit breaker is an electrical switch in which an insulating or dielectric oil is used for arc quenching. As we know, when a fault occurs in the electrical system, we ... Read More

1 2 3 4 5 ... 10961 Next
Advertisements