AYUSH MISHRA

AYUSH MISHRA

112 Articles Published

Articles by AYUSH MISHRA

Page 6 of 12

Convert a number to Roman numerals in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 27-Jan-2025 4K+ Views

Problem Description In this problem, we are given a number, and we need to convert it to its equivalent Roman number representation using C#. Example 1 Input: number = 58 Output: Roman numeral = LVIII Explanation: 58 in Roman numerals is written as L (50) + V (5) + III (3). Example 2 Input: number = 1994 Output: Roman numeral = MCMXCIV Explanation: 1994 in Roman numerals is written as M (1000) + CM (900) + XC (90) + IV ...

Read More

C++ Program to Calculate Volume of Capsule

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

A capsule is a three-dimensional geometric shape 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 C++ using different approaches. Formula for Volume of Capsule The formula for the volume of a capsule is as follows: Volume of Capsule = Volume of cylinder + Volume of both ...

Read More

JavaScript Program to Find the average of all positive numbers in an array

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

In this article, we will learn how to find the average of all positive numbers in an array using JavaScript, along with examples to demonstrate the implementation.  We are given an array of integers, which may contain both negative and positive numbers. Our task is to calculate the average of all the positive numbers in the array. Problem Description The goal is to compute the average of all positive numbers in a given array. This involves summing up the positive numbers and dividing the sum by the count of positive numbers. Input 1 arr = [2, -5, 6, -3, 8]; ...

Read More

Find the sum of cubes of the first N natural numbers in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 24-Jan-2025 4K+ Views

Problem Description We are given a number N, and we need to calculate the sum of the cubes of the first N natural numbers. In this article, we are going to learn how we can find the sum of cubes of the first N natural numbers C#. Example 1 Input: N = 3 Output: 36 Explanation: The cubes of the first 3 natural numbers are: 13 = 1, 23 = 8, 33 = 27 The sum of these cubes is:1 + 8 ...

Read More

Calculate the sum of squares of the first N natural numbers in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 24-Jan-2025 4K+ Views

Problem Description In this problem, we are given a number n, and we need to calculate the sum of the squares of the first N natural numbers. In this article, we are going to discuss different approaches to solving this problem using C#. Example 1 Input: N = 4 Output: 30 Explanation: The squares of the first 4 natural numbers are: 1, 4, 9, 16. The sum of the numbers is: 1 + 4 + 9 + 16 = 30. Example 2 Input: ...

Read More

Remove all even numbers from an array in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 24-Jan-2025 19K+ Views

Natural numbers are a set of positive integers, which are commonly used for counting and ordering. They begin from 1 and continue infinitely. In some contexts, it may also include 0. Here, we are going to learn about different approaches to removing all odd numbers from a given array using C#. Problem Description We are given an array and need to remove all the even numbers from it. The resulting array should only contain odd numbers. In this article, we are going to discuss different approaches to solving this problem using C#. Example 1 Input: array ...

Read More

C++ Program to Print Hollow Square Pattern

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

When we start learning to code, practicing star patterns is one of the best ways to improve logic building. One of the simplest yet fascinating patterns is the hollow square pattern. In this article, we are going to learn how to print a Hollow Square Pattern using C++. What is Hollow Square Pattern? A hollow square pattern is a geometrical arrangement of stars forming a square shape, but the stars are present only at the boundary of the square. The stars are printed in such a manner that the edges of the square are filled with stars, while the interior ...

Read More

Remove all odd numbers from an array in C#

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

Natural numbers are a set of positive integers, which are commonly used for counting and ordering. They begin from 1 and continue infinitely. In some contexts, it may also include 0. Here,  we are going to learn about different approaches to removing all odd numbers from a given array using C#. Problem Description We are given an array, and we need to remove all the odd numbers from it. The resulting array should only contain even numbers. Example 1 Input: array = {1, 2, 3, 4, 5, 6} Output: {2, ...

Read More

PHP Program for Binary to Decimal Conversion

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

Binary to decimal conversion is the process of converting a binary number i.e., number represented using only two bits 0s and 1s into its equivalent decimal number i.e., base 10 form. In this article, we are going to learn how we can convert the binary form of a number to a decimal form of a number in PHP using different approaches. How to convert Binary to Decimal? Binary numbers (base-2) are composed of only 0s and 1s bits which are used by machines, Decimal numbers are base-10 form numbers that humans use. For converting a binary number to a decimal, ...

Read More

Java Program to Find the Volume of Capsule

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

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 Java using different approaches. Formula for Volume of Capsule The formula for the volume of a capsule is as follows: Volume of Capsule = Volume of cylinder + Volume of both ...

Read More
Showing 51–60 of 112 articles
« Prev 1 4 5 6 7 8 12 Next »
Advertisements