Programming Articles - Page 2473 of 3366

Angle between two Planes in 3D in C Program?

Aman Kumar
Updated on 30-Jul-2025 14:13:45

182 Views

In 3D geometry, planes are flat surfaces extending infinitely in space. When two planes intersect, they form a line, and the angle between them becomes an important geometric measure. In this article, we will learn how to calculate the angle between two planes in 3D space using a C program. The diagram below illustrates two planes intersecting in 3D space. These planes can be represented by the following equations: Equation P1: a1 * x + b1 * y + c1 * z + d1 = 0 P2: a2 * x + b2 * y + c2 * ... Read More

Alphanumeric Abbreviations of a String in C Program?

Arnab Chakraborty
Updated on 20-Aug-2019 11:31:43

544 Views

Here we will see one interesting problem related to alphanumeric abbreviation of a given string. The string length is less than 10. We will print all alphanumeric abbreviations.The alphanumeric abbreviation is in the form of characters mixed with the digits. The value of that digit is number of characters that are missed. There may be any number of skipped substrings. No two substrings are adjacent to each other. Let us see the algorithm to get the idea.AlgorithmprintAbbreviation(s, index, max, str) −begin    if index is same as max, then       print str    end if    add s[index] ... Read More

Adding one to number represented as array of digits in C Program?

Arnab Chakraborty
Updated on 20-Aug-2019 14:25:16

329 Views

In this section we will see one interesting problem. Suppose one number is given. We have to increase this number by 1. This is extremely simple task. But here we will place the number as an array. each digit of that number is placed as an element of the array. If the number is 512, then it will be stored as {5, 1, 2}. And also we have to increase the number using recursive approach. Let us see the algorithm to get the clear idea.Algorithmincrement(arr, n, index) −Initially the default value of index is 0 begin    if index < ... Read More

Cplus plus vs Java vs Python?

Arnab Chakraborty
Updated on 20-Aug-2019 14:22:45

419 Views

Here we will see some basic differences between C++, Java and the Python. At first we will see the C++ and Java differences, then the Java and Python differences.TopicC++JavaMemory ManagementIt uses pointers, structures, unions and referencesIt does not support pointers. It supports references. It also supports Threads, interfacesLibrariesLow level functional librariesWide range of library, with various functionalitiesMultiple InheritanceSupports multiple inheritance using normal classesSupports multiple inheritance with only interfaces (pure abstract classes)Operating OverloadingOperator overloading is supportedDoes not support operator overloadingProgram HandlingFunctions and variables can reside outside of the classesFunctions, variables can only be there inside classes or packagesPortabilityCode is dependent on ... Read More

Can we define multiple methods in a class with the same name in Java?

Vivek Verma
Updated on 14-May-2025 13:11:32

8K+ Views

Yes, we can define multiple methods in a class with the same name. But if we have two methods with the same name, the compiler should be able to differentiate between the two methods. Therefore, in Java, "we can define multiple methods" with the same name in a single class, as long as each method has a different set of parameters. When we invoke a method, the compiler executes the respective body (code) based on the arguments passed.This concept is known as method overloading. Method Overloading in Java In Java, method overloading is a type of compile-time polymorphism. Polymorphism is one ... Read More

C++ Program to remove spaces from a string?

sudhir sharma
Updated on 20-Aug-2019 09:02:02

1K+ Views

The program takes a string and removes the spaces in it. This is useful when we want to save the space of our The following sample shows how it is done with an explanation.Input: Hello World Output: HelloWorldExplanationTo remove or delete spaces from the string or sentence, you have to ask the user to enter a string. Now start checking for spaces. If space will be found, then start placing the next character from the space to the back until the last character and continue to check for the next space to remove all the spaces present in the stringExample#include ... Read More

C/C++ Program for Linear Search?

sudhir sharma
Updated on 30-Jun-2025 13:17:38

9K+ Views

What is Linear Search? Linear search is a sequential searching technique in which we start at one end of the list or array and look at each element until the target element is found. It is the simplest searching algorithm, with O(n) time complexity. Example Scenario let's see the following example scenario: Input: arr = {5, 4, 3, 8, 10}, K = 3; Output: 3 found at index 2; Input: arr = {1, 2, 3, 4, 5}, K = 7; Output: Not Found; How Linear Search Work? Following are the steps to search an element in array or ... Read More

C++ Program to find whether a number is the power of two?

sudhir sharma
Updated on 30-Jun-2025 13:19:04

3K+ Views

In this article, we will implement a C++ program to find whether a number is a power of two. So, you are given a positive integer n; the task is to find if the given number is a power of 2 or not. Let's see some of the numbers that represent the power of two. 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 ... Example Scenario Let's see the following example scenario: Input: 4 Output: yes Explanation: 22 = 4 Input: 16 Output: yes Explanation: 24 = 16 Input: 5 Output: no Explanation: ... Read More

C++ Program for Cycle Sort?

sudhir sharma
Updated on 30-Jun-2025 13:20:32

524 Views

What is Cycle Sort? Cycle sort is an in-place, unstable sorting algorithm. It is a comparison sort that is theoretically optimal in terms of the total number of writes to the original array, unlike any other in-place sorting algorithm. A sorting algorithm is in-place sorting in which the sorted items occupy the same place as the original one. Key Points of Cycle Sort Following are the key points: It is optimal in terms of number of memory writes. It minimize the number of memory write to sort (Each value is either written zero times, if ... Read More

C Program to Find the minimum sum of factors of a number?

sudhir sharma
Updated on 20-Aug-2019 08:50:59

430 Views

The program to find the minimum sum of factors of a number. The logic for solving this problem is, find all the set of factors and adding them. For every set of factors, we will do the same and then compare all of them. Then find all the minimum of these sums.Input: n=12 Output: 7ExplanationFirst find the factors of number n then sum them and try to minimize the sum. Following are different ways to factorize 12 and sum of factors in different ways.12 = 12 * 1 = 12 + 1 = 13 12 = 2 * 6 = ... Read More

Advertisements