Convert a Number to Roman Numerals in C#

AYUSH MISHRA
Updated on 27-Jan-2025 13:16:12

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

Calculate Volume of Capsule in C++

AYUSH MISHRA
Updated on 27-Jan-2025 13:15:57

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

Get Current Date and Time in Seconds using JavaScript

Yaswanth Varma
Updated on 27-Jan-2025 12:34:26

13K+ Views

In JavaScript, there are built-in methods for getting the current date and time in seconds. We are going to perform this in two ways − Using the Date.now() method Using a new date getTime() method Let’s dive into the article for getting better understanding on getting current date time in seconds. Using Date.now() method The Date.now() static method returns the milliseconds that ... Read More

Find Average of All Positive Numbers in an Array in JavaScript

AYUSH MISHRA
Updated on 27-Jan-2025 12:33:21

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 Action Attribute and Method of a Form in JavaScript

Lokesh Yadav
Updated on 27-Jan-2025 12:06:11

3K+ Views

In this article we are going to learn how to find the action attribute and method of a form with suitable examples in JavaScript. In HTML, there is  elements which has few attributes: input, label, text area, select, name, target. The action and method attributes of the form are used to return those values. The action attribute also specifies where to send the form data when form is submitted. To get a better idea of this concept, let’s look into JavaScript examples where we achieved the given task using action attribute and also with method attribute. Using action ... Read More

JavaScript Program for Number of Pairs with Maximum Sum

Ravi Ranjan
Updated on 27-Jan-2025 11:27:38

356 Views

JavaScript program for number of pairs with maximum sum is a common coding problem that involves finding the number of pairs in an array that have the maximum sum. This problem can be solved using various approaches which we will be discussing with code examples and their stepwise explanation. In this article we are having an array of integers. Our task is to write a JavaScript program for number of pairs with maximum sum. Example 1 Input: array = [1, 2, 3, 4, 5] Pair sum of (1, 2) = 3, Pair sum of (1, 3) = ... Read More

Sum of Cubes of First N Natural Numbers in C#

AYUSH MISHRA
Updated on 24-Jan-2025 16:21:48

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
Updated on 24-Jan-2025 16:21:30

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
Updated on 24-Jan-2025 16:21:11

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

Use ChatGPT for Business

Prakash Joshi
Updated on 24-Jan-2025 16:20:37

168 Views

Our interactions with others are increasingly moving online and business conversations are being taken over by AI technology. Businesses use chatbots to engage with their customers in an increasing variety of ways, and this trend is not unique to them. One such AI chatbot that may be used for many tasks is ChatGPT. We'll introduce you to ChatGPT and some of the ways it can help your business succeed in this article. By the end of this article, you’ll know everything on how to get started with ChatGPT and how to use ChatGPT for the benefit of your business. ... Read More

Advertisements