Programming Articles

Page 565 of 2544

Check if a Matrix is Identity Matrix or not in Java?

Mr. Satyabrata
Mr. Satyabrata
Updated on 06-Mar-2023 2K+ Views

Matrices are nothing but it’s more than a collection of data elements arranged in a rectangular layout that is two-dimensional. In Java, an array with two dimensions can be considered as a matrix. Identity matrix is a square matrix which has all 1s as its principal diagonal elements and rest are 0s. As per the problem statement we have to0 check if the given matrix is Identity matrix or not. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose we have a matrix ...

Read More

Find Two Array Elements Having Maximum Sum in Java?

Mr. Satyabrata
Mr. Satyabrata
Updated on 06-Mar-2023 3K+ Views

Two elements giving the maximum sum in an array means, we have to find two largest array elements which will eventually give the maximum sum possible. In this article we will see how we can find the maximum sum of two elements in Java. To show you some instances Instance-1 Suppose we have the below array [10, 2, 3, -5, 99, 12, 0, -1] In this array the largest element is 99 and second largest is 12. Max sum = 99 + 12 Hence the maximum sum of two elements in this array is 111. Instance-2 Suppose we have the ...

Read More

Find Two Array Elements Having Maximum Product in Java?

Mr. Satyabrata
Mr. Satyabrata
Updated on 06-Mar-2023 1K+ Views

Two elements giving the maximum product in an array means, we have to find two largest array elements which will eventually give the maximum product possible. In this article we will see how we can find the maximum product of two elements in Java. To show you some instances Instance-1 Suppose we have the below array [10, 2, 3, -5, 99, 12, 0, -1] In this array the largest element is 99 and second largest is 12. Max product = 99 * 12 Hence the maximum product of two elements in this array is 1188. Instance-2 Suppose we have the ...

Read More

Find Scalar Multiplication of a Matrix in Java?

Mr. Satyabrata
Mr. Satyabrata
Updated on 06-Mar-2023 812 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. The matrix in java is nothing but a multi-dimensional array which represents multiple rows and columns. Scalar multiplication is nothing but multiplication between a matrix and a real number. The result of this multiplication is in matrix format. As per the problem statement, we have to find the scalar multiplication of a matrix. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original matrix ...

Read More

Find index of 0 or Any Negative Integer Element Present in Array in Java

Mr. Satyabrata
Mr. Satyabrata
Updated on 06-Mar-2023 848 Views

As per the problem statement, we have given an array with some random integer values and we have to find out and print the index which contains any zero or negative values. Note - Take an integer array Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5] The index contains Zero and negative values = 2, 3, 4 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5] The index contains Zero and negative values = 0, 1, ...

Read More

Locate unused structures and structure-members

Satish Kumar
Satish Kumar
Updated on 03-Mar-2023 1K+ Views

Structures in programming languages like C and C++ are a collection of related data fields, which can be accessed and manipulated as a single entity. They are often used to group related data items into a single variable, making it easier to manage and work with complex data structures. However, as code bases grow and evolve over time, it is not uncommon for structures and their members to become unused or redundant. These unused structures and members can clutter code and make it more difficult to understand, maintain, and update. In this article, we will discuss some ways to locate ...

Read More

Corrupt stack problem in C, C++ program

Satish Kumar
Satish Kumar
Updated on 03-Mar-2023 3K+ Views

Introduction The corrupt stack problem is a common issue that programmers encounter while developing software in C and C++ programming languages. This problem can arise due to a wide range of reasons and can cause severe problems in functioning of program. In this article, we will explore corrupt stack problem in detail and look at some examples of how it occurs. What is a Stack in C and C++? Before we discuss corrupt stack problem, we need to understand what a stack is. In C and C++, a stack is a data structure that allows data to be stored and ...

Read More

Haskell Program to calculate the value from the given fraction and exponent

Akhil Sharma
Akhil Sharma
Updated on 01-Mar-2023 316 Views

This haskell tutorial will help us in calculating the value from the given fraction and exponent of a number. To find this, the input is taken as fraction and exponent, and its corresponding value is computed. Algorithm Step 1 − The “Data.Ratio” is imported to work over fractions. Step 2 − The calculateValue function is defined Step 3 − Program execution will be started from main function. The main() function has whole control of the program. It is written as main = do. Step 4 − The variables named, “fraction” and “exponent” are initialized. ...

Read More

Find Array Elements Which are Greater than its Left Elements in Java?

Mr. Satyabrata
Mr. Satyabrata
Updated on 01-Mar-2023 586 Views

An array is a linear data structure in which elements are stored in contiguous memory locations. As per the problem statement, we have given an array with some random integer values and we have to find out the numbers which are greater than its all left elements by using Java programming language. Let’s start! To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5]. The numbers which are greater than its all left elements = 2, 5 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5]. The numbers which are greater than its all left ...

Read More

Golang program to include a module inside the class

Akhil Sharma
Akhil Sharma
Updated on 01-Mar-2023 185 Views

In Go programming language, a new module is initiated using init command after which we can import other modules in our code. There is no concept of class in Go, only structs are used. In this article, we will use one example to include a module inside the class. In this example, we will create a Circle struct whose area will be printed on the console. For this example, we will import math and fmt packages outside the struct but they can be used anywhere. The print statement is executed using Printf function from the fmt package. Algorithm Import ...

Read More
Showing 5641–5650 of 25,433 articles
« Prev 1 563 564 565 566 567 2544 Next »
Advertisements