Found 7333 Articles for C++

C++ Program to Return Quadrants in which a given Coordinates Lies

AYUSH MISHRA
Updated on 28-Nov-2024 11:31:47

4K+ Views

Cartesian-coordinate System and Quadrants The cartesian-coordinate system is divided into four Quadrants: Quadrant I, Quadrant II, Quadrant III, and Quadrant IV. In this article, we are going to learn how we can determine the quadrant in which given points i.e., x and y, lie. Problem Description We are given the position of a point (x, y), and we have to determine in which quadrant this point lies. Example Input: (-3, 2) Output: Quadrant II Input: (2, 5) Output: Quadrant I Input: (2, -4) Output: Quadrant IV Input: (-6, -3) Output: Quadrant III Using Conditional Quadrant Identification Approach ... Read More

C++ Program for Sum of Infinite Terms in GP

AYUSH MISHRA
Updated on 21-Nov-2024 19:28:56

3K+ Views

What is Geometric Progression (GP)? Geometric Progression (GP) is a sequence of numbers where each term is generated by multiplying the previous term by a constant value. This constant value in GP is known as the common ratio. In this article, we are going to discuss how to calculate the sum of infinite terms in a GP using different approaches in C++. Note: The important condition to remember is that a positive valid sum of infinite GP is only possible if the absolute of the common value (r) is less than 1, i.e., ∣r∣ < 1. Methods to Calculate ... Read More

C++ program to return all Boundary Elements of a Matrix

AYUSH MISHRA
Updated on 28-Nov-2024 11:49:26

4K+ Views

boundary elements of a matrix The boundary elements of a matrix are those elements that lie along its edges. A matrix is a two-dimensional array that can be of any given size. The boundary elements are those present on the edges of the matrix. Problem Description We are given a matrix of size m × n. We need to find the boundary elements of the matrix. Boundary elements are the elements present on the top and bottom rows and the first and last columns of the matrix. Below are examples to understand the boundary traversal of a matrix: ... Read More

C++ Program to check if a Number is Harshad Number

AYUSH MISHRA
Updated on 21-Nov-2024 11:40:18

4K+ Views

A Harshad number is a special type of number. A Harshad number or Niven number is a number that is completely divisible by the sum of its digits without leaving any remainder. In this article, we are going to learn how we can check whether a given number is a Harshad number or not. Problem Description We are given a number and we have to return true if the given number is Harshad or Niven number and false if the given number is not a Harshad number. Example 1 Input: 108 Output: yes Explanation: The sum ... Read More

C++ program to print all non-boundary elements of matrix

AYUSH MISHRA
Updated on 20-Nov-2024 23:05:54

4K+ Views

A matrix is a two-dimensional array. The elements that are present on the edges are called boundary elements, and the elements that are present inside the matrix, not present on the edges, are known as non-boundary elements. In this article, we are going to discuss how to print non-boundary elements of the matrix. Problem Description We are given a matrix and we have to print all non-boundary elements present in the matrix. Rows and columns are present ... Read More

C++ Program to Convert Minutes into Seconds

AYUSH MISHRA
Updated on 15-Nov-2024 14:57:38

4K+ Views

Minutes and seconds are time units commonly used in applications ranging from digital clocks to timekeeping in games and simulations. Converting minutes into seconds is a straightforward operation but essential in many time-sensitive applications. In this article, we will learn how to convert minutes to seconds using C++. Formula The formula to convert minutes to seconds is: seconds = minutes × 60 Examples Input 5 Output 300 Input 10 Output 600 Using Function We will write code that defines a function, convertMinutesToSeconds. This function will take the minutes as an input parameter for ... Read More

Check if a given String is palindrome using two pointer in C++

AYUSH MISHRA
Updated on 13-Nov-2024 16:48:04

5K+ Views

A palindrome is a word, phrase, number, or other sequence of characters that reads the same from both backward and forward sides. In strings, the palindrome strings are those strings that can be read the same from both left and right sides. In this article, we are going to learn how we can check if a given string is palindrome or not using the two-pointer technique in C++. Problem We are given a string, and we have to check if it is palindrome or not using the two-pointer method in C++. Example 1 ... Read More

Program to find Median if Mean and Mode are given of an array in C++

AYUSH MISHRA
Updated on 13-Nov-2024 16:45:24

4K+ Views

Mean, Median, and Mode are fundamental statistical measures that are used to describe the central tendency and also explain the spread of the sheet. These three measures help in understanding the overall distribution of the data. In this article, we are going to learn how to find the Median if we are given the Mean and Mode of an array in C++. Problem Statement We are given an array of numbers, and we need to calculate the Median, in case when Mean and Mode of an array are given in C++. Example Input [5, 15, 25, 35, ... Read More

Program to find Mean if Median and Mode are given of an array in C++

AYUSH MISHRA
Updated on 13-Nov-2024 17:55:16

4K+ Views

Mean, Median, and Mode are key statistical measures that help in describing a dataset's central tendency and distribution. These quantities help in understanding the central tendency and distribution of the given data. In this article, we will learn how to find the Mean if the Median and Mode of a given array are known in C++. Problem Statement We are given an array of numbers, and we need to find the mean if the median and mode are provided in C++. Example Input: [5, 15, 25, 35, 35, 40, ... Read More

Program to find Mode if Mean and Median are given of an array in C++

AYUSH MISHRA
Updated on 10-Nov-2024 13:49:04

4K+ Views

Mean, median and mode are three basic concepts of statistics. These quantities help in understanding the central tendency and distribution of given data. In this article we are going to learn, how we can find the Mode if the Mean and Median of a given array (which is the same as ungrouped data) in C++.  Problem statement We are given an array of numbers and we have to find the mode if mean and median are given in C++.  Example Input [5, 15, 25, 35, 35, 40, 10] Mean = 20Median = 25 Output 35 Brute Force Approach Mode is ... Read More

Previous 1 ... 3 4 5 6 7 ... 734 Next
Advertisements