Problem Sort the given array in descending or ascending order based on the code that has been written. Solution An array is a group of related data items which share’s a common name. A particular value in an array is identified with the help of its "index number". Declaring array The syntax for declaring an array is as follows − datatype array_name [size]; For example, float marks [50] It declares ‘marks’ to be an array containing 50 float elements. int number[10] It declares the ‘number’ as an array to contain a maximum of 10 integer constants. Each element is identified ... Read More
Attackers always come up with new ways to breach networks and steal confidential data for all users in the field of cybersecurity. A cybersecurity issue known as the "watering hole attack" occurs when any particular hacker compromises websites that a certain user base is known to visit regularly to target their initial activities.After hacking the website, the attackers infect visitors' computers or phones with malware functions within the system. They rely on the fact that this website is frequently visited by the group they wish to target all the particular information. Attackers can infiltrate people's devices to steal confidential information ... Read More
In mathematics, the factors of a number are the integers that divide the number without leaving a remainder. For a given number, finding the minimum sum of its factors involves identifying a pair of factors whose sum is the smallest among all possible factor pairs. In this article, we will learn to find the minimum sum of factors of a number we will be using the Integer class and Math class in Java − Integer class The Java Integer class serves as a wrapper for the primitive int type, encapsulating a single integer value within an object. For Integer.MAX_VALUE, which provides ... Read More
In this article, we will be exploring strings and how they can be used as a literal and an object depending on the requirements. In JavaScript, strings can exist in two forms: String Literal: Created using quotes (', ", or `).String Object: Created explicitly using the String constructor, e.g., new String("text"). JavaScript Literals A JavaScript literal can be referred to as representing fixed values in source code. In most languages, values are denoted by Integers, floating-point numbers, strings, boolean, characters, arrays, records, and many more. JavaScript Objects On the other hand, a JavaScript object can be defined as a list of ... Read More
JavaScript is no longer limited to web development; it has expanded into controlling hardware devices, thanks to frameworks like Johnny-Five. Johnny-Five is a powerful and user-friendly JavaScript robotics library that allows developers to interact with hardware components like LEDs, motors, sensors, and more using microcontrollers such as Arduino. What is Johnny-Five? Johnny-Five is a JavaScript robotics and IoT (Internet of Things) platform that allows you to control hardware devices using JavaScript. It provides a simple and intuitive API that abstracts the complexities of working with electronics, making it easier for developers to prototype and experiment with physical computing projects. Johnny-Five ... Read More
C++ is a statically typed language. To write programs we need to define variables of specified types. Sometimes we need to read inputs from the console or files. In such a scenario the string data are read into the program. To convert them into other datatypes needs special operations. In this article, we shall discuss how to convert strings to integers in C++. There are a few different techniques to do so. Let us explore them one by one. String to Integer Using stringstream Class C++ uses streams for different applications. Such streams are filestreams, standard input/output streams, etc. There ... Read More
Swap two arrays without using a temporary variable. We will use arithmetic and bitwise Operators instead of a third variable. The logic to read the first array is as follows − printf("enter first array ele:"); for(i = 0; i < size; i++){ scanf("%d", &first[i]); } The logic to read the second array is as follows − printf("enter first array ele:"); for(i = 0; i < size; i++){ scanf("%d", &first[i]); } The logic to swap the two arrays without using a third variable is as follows − for(i = 0; i < size; i++){ ... Read More
Binary numbers are represented in 1’s and 0’s. It can also be referred to as a rational number with a finite representation in the system. This is a quotient of an integer by a power of two. Hexadecimal number system with 16 digits is {0, 1, 2, 3…..9, A(10), B(11), ……F(15)}. In base 16 transfer encoding, each byte of plain text is divided into two 4-bit values, which are represented by two hexadecimal digits. Converting Binary to Hex using C To convert from binary to hexadecimal representation, the bit string is grouped into 4-bit blocks, called nibbles, starting from the ... Read More
By using justifications in the printf statement, we can format the data in various ways. To implement the right justification, insert a minus sign before the width value in the %s character. printf("%-15s", text); Program 1 The example below prints a table with name and amounts, formatted in two columns with fixed widths for better alignment, using printf() for row and column-wise output. #include int main(){ char a[20] = "Names", b[20]="amount to be paid"; char a1[20] = "Bhanu", b1[20]="Hari", c1[20]="Lucky", d1[20]="Puppy"; int a2 = 200, b2 = 400, c2 = ... Read More
In this article, we are going to learn about the different sorting techniques and their implementations in C language. Sorting in C programming requires rearranging elements in the array into a determined order, i.e., in ascending or descending order. This will use the comparison operator to specify the new order of a list or array. This is widely used in different applications that include searching algorithms, data structure optimization, and database management. The following are the sorting techniques that we can implement with C language and other programming also: ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP