AYUSH MISHRA

AYUSH MISHRA

112 Articles Published

Articles by AYUSH MISHRA

Page 7 of 12

JavaScript program to find the average of all negative numbers in an array

AYUSH MISHRA
AYUSH MISHRA
Updated on 22-Jan-2025 6K+ Views

In this problem, we are given an array of integers, which may contain both negative and positive numbers. We have to find the average of all the negative numbers in the array. In this article, we are going to learn how we can find the average of all negative numbers in an array using JavaScript. Example 1 Input arr = [1, -3, 4, -2, -5]; Output -3.33 Explanation The negative numbers in the array are -3, -2, and -5. Their sum is -10, and the number of negative elements is 3. The average is: -10 / 3 = -3.33. ...

Read More

Python Program for Fahrenheit to Celsius conversion

AYUSH MISHRA
AYUSH MISHRA
Updated on 21-Jan-2025 15K+ Views

Problem Description In this problem, we are given a temperature value in Fahrenheit and we have to convert it to Celsius. This conversion is used in various real-world applications such as weather applications, scientific calculations, and data analysis. In this article, we are going to discuss, how we can convert Fahrenheit temperature to Celsius temperature in Python. Formula to Convert Fahrenheit to Celsius The formula for converting Fahrenheit to Celsius is: Celsius = (Fahrenheit - 32) / 1.8 Example 1 Input: Fahrenheit = 98.6 Output: Celsius = 37°C Explanation: The ...

Read More

Remove Duplicates from an Unsorted Array in C++

C++
AYUSH MISHRA
AYUSH MISHRA
Updated on 21-Jan-2025 6K+ Views

Problem Description In this problem, we are given an unsorted array, and the task is to remove all duplicate elements from the array. The resulting array should only contain unique elements. In this article, we are going to explore different approaches to removing duplicates from an unsorted array in C++. Example 1 Input: array = {4, 3, 2, 4, 1, 3, 2} Output: {4, 3, 2, 1} Explanation: The duplicate elements (4, 3, 2) are removed, leaving only unique elements. Example 2 Input: array ...

Read More

C++ program to calculate potential energy if mass and height are given

C++
AYUSH MISHRA
AYUSH MISHRA
Updated on 20-Jan-2025 14K+ Views

What is Potential Energy? Potential energy is a type of stored energy stored by an object due to its position relative to other objects. It is an important concept in physics and is commonly calculated when studying objects in gravitational fields. In this tutorial, we are going to learn how to calculate the potential energy of an object in C++ if the mass and height are given. Formula for Calculating Potential Energy The formula for potential energy is as follows: Potential Energy = m × g × h Where:m is the mass of the object (in kilograms).g is the gravitational ...

Read More

Finding sum of alternative elements of the array using C++

C++
AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Jan-2025 7K+ Views

The sum of alternate elements has various real-life applications such as signal processing, data compression, pattern recognition, gaming, and financial data analysis. Problem Description In this article, we are going to learn how to find the sum of alternate elements of an array in C++. Alternate elements are present at even or odd indices of the array, depending on how we define them.  Example 1 Inputarray = [1, 2, 3, 4, 5] OutputSum_even = 9Sum_odd = 6 Explanation The alternate elements at the even index are 1, 3, 5 (at ...

Read More

Python program to find perimeter of rectangle

AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Jan-2025 6K+ Views

A rectangle is a closed two-dimensional figure having 4 sides. The opposite sides are equal and parallel. The angle made by the adjacent side is equal to 90 degrees. The perimeter is the sum of all sides; in other words, the perimeter is two times the sum of length and breadth. In this tutorial, we are going to learn how we can find the perimeter of a given rectangle in Python using different approaches. Formula of Perimeter of Rectangle The formula for the perimeter of a rectangle is as follows: Perimeter of Rectangle = 2 × (length + breadth) ...

Read More

Python program to find volume of capsule

AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Jan-2025 5K+ Views

What is Capsule and Its Volume? A capsule is a three-dimensional geometric figure that consists of a cylindrical body with hemispherical ends on both sides. The volume of a capsule can be calculated by adding the volume of the cylindrical part and the volume of the two hemispherical ends present on both sides of the cylindrical part. In this tutorial, we are going to discuss how to find the volume of a given capsule in Python using different approaches. Formula for Volume of Capsule The formula for the volume of a capsule is as follows: Volume of Capsule = ...

Read More

PHP Program to Count Vowels in a String

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Jan-2025 8K+ Views

A string is a sequence of characters, including alphabets, numbers, and symbols. In this tutorial, we are going to learn how we can count the number of vowels in a given string in PHP using different approaches. Vowels in English are a, e, i, o, u, and they can be either uppercase or lowercase. What is a Vowel? Vowels are alphabetic characters that represent specific speech sounds.There are a total of five vowels, both uppercase and lowercase in the English language: a, e, i, o, u Example 1 Input: string = "Tutoriaspoint" ...

Read More

Python program to find perimeter of square

AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Jan-2025 5K+ Views

A square is a closed two-dimensional figure having 4 equal sides. Each angle of a square is 90 degrees. The perimeter of a square is the sum of all its sides. Problem Description In this problem, we are given the side of a square, and we have to find the perimeter of the square. In this tutorial, we are going to find the perimeter of a given square in Python using different approaches. Example 1 Input: side = 6 units Output: 24 units Explanation Using the formula to calculate ...

Read More

C# Program to Subtract Two Numbers

AYUSH MISHRA
AYUSH MISHRA
Updated on 09-Jan-2025 6K+ Views

Problem Description In this problem, we are given two numbers, and we have to find the value obtained after subtracting one number from another. In this article, we are going to learn how we can subtract two numbers in C# using different approaches. Example 1 Input:number1 = 8number2 = 12 Output: 4 Explanation The subtraction of number2 - number1, i.e., 12 - 8, will result in 4. Example 2 Input:number1 = 10number2 = 10 Output: 0 ...

Read More
Showing 61–70 of 112 articles
« Prev 1 5 6 7 8 9 12 Next »
Advertisements