When a static keyword is used, variables, data members, and functions can not be modified again. It is allocated for the lifetime of the program. Static functions can be called directly by using a class name. Key Points of Static Variables Static variables are variables that are defined using static keywords, which consist of special behavior compared to regular variables. Here we will see its key points. Static variables are initialized only once. The compiler persists the variable till the end of the program. Static variables can be defined inside or ... Read More
Problem Description Given the length and breadth of a rectangle, we need to implement a PHP program to find the perimeter. A rectangle is a closed two-dimensional figure having 4 sides. The opposite sides are equal and parallel. The angle made by the adjacent side is equal to 90 degrees. The perimeter is the sum of all sides; in other words, the perimeter is two times the sum of length and breadth. In this tutorial, we are going to learn how we can find the perimeter of a given rectangle in PHP using different approaches. Formula of Perimeter of ... Read More
Problem Write a program to calculate the area of triangle, square, circle, rectangle and polygon by using the switch case. Solution Based on case number, the area of triangle, square, circle, rectangle and polygon is calculated. The logic used to find area of triangle is as follows − Enter sides of a triangle a, b, c s=(float)(a+b+c)/2; area=(float)(sqrt(s*(s-a)*(s-b)*(s-c))); The logic used to find area of square is as follows − Enter the side of square at runtime. area=(float)side*side; The logic used to find ... Read More
Problem Applying the software development method to solve any problem in C Language. Solution Find roots of a quadratic equation, ax2+bx+c. There will be 2 roots for given quadratic equation. Analysis Input − a, b, c values Output − r1, r2 values Procedure $r_{1}=\frac{-b+\sqrt{b^2-4ac}}{2a}$ $r_{2}=\frac{-b-\sqrt{b^2-4ac}}{2a}$ Design (Algorithm) Start Read a, b, c values Compute d = b2 4ac if d > 0 then ... Read More
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
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP