Articles on Trending Technologies

Technical articles with clear explanations and examples

How to use calc() in tailwind CSS?

Disha Verma
Disha Verma
Updated on 04-Dec-2024 353 Views

Many developers find it difficult to use the calc() function in Tailwind CSS, which limits their ability to create responsive and dynamic layouts. This article explains how to implement calc() effectively, improving design flexibility and precision. What is calc() in CSS? The CSS Calc() function allows you to perform calculations to determine CSS property values and perform arithmetic operations (addition, subtraction, multiplication, and division) directly within your CSS. Approaches For Calc() With Tailwind CSS Tailwind doesn't have built-in utilities for calc(), but you can still use it in different ways. Using Inline Styles ...

Read More

Java program to check if all digits of a number divide it

AmitDiwan
AmitDiwan
Updated on 03-Dec-2024 360 Views

The given article involves determining if all digits of a positive integer can divide the number without leaving a remainder. If any digit is zero or does not divide the number the result is false; otherwise, it is true using Java. This can be solved using two approaches: the Naive-Based Approach, which relies on arithmetic operations, and the String-Based Approach, which uses string manipulation for digit processing. Both methods ensure each digit meets the divisibility condition efficiently. Approaches to Check If All Digits of a Number Divide It Following are the different approaches to check if all digits of a ...

Read More

JavaScript example for Capturing mouse positions after every given interval

AmitDiwan
AmitDiwan
Updated on 03-Dec-2024 384 Views

In this article, we will demonstrate how to capture the mouse position in JavaScript at regular intervals and log or use this data for various purposes. Capturing mouse positions after every given interval refers to a program or functionality where the current position of the mouse pointer is tracked at regular time intervals. This can be useful in scenarios like debugging, interactive applications, or visualizing user movement on a web page. Use Cases Imagine you want to monitor user activity on a web page and record the mouse position every second. This can be useful for: ...

Read More

Type Inference in C++ (auto and decltype)

Ayush Gupta
Ayush Gupta
Updated on 03-Dec-2024 324 Views

In this tutorial, we will be discussing a program to understand Type interference in C++ (auto and decltype). In the case of auto keyword, the type of the variable is defined from the type of its initializer. Further, with decltype, it lets you extract the type of variable from the called element. auto type Example Here is the following example of auto-type in C++. #include using namespace std; int main() { auto x = 4; auto y = 3.37; auto ptr = & x; cout

Read More

Bitwise AND of N binary strings in C++

sudhir sharma
sudhir sharma
Updated on 03-Dec-2024 776 Views

In this problem, we are given an array bin[] of size n of binary strings. Our task is to create a program to find the Bitwise AND (&) of N binary strings. Here, we will take all numbers and find the bitwise AND of them i.e. bin[0] & bin[1] &... bin[n-2] & bin[n] Example Let’s take an example to understand the problem. Input − bin[] = {“1001”, “11001”, “010101”} Output − 000001 Explanation Bitwise AND of all binary strings − (1001) & (11001) & (010101) = 000001 To solve this problem, ...

Read More

Largest gap in an array in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 03-Dec-2024 340 Views

In this tutorial, we are going to write a program that finds the largest difference between the two elements in the given array. Approach Let's look at the approach we will follow to solve this problem. Firstly, we will initialize the array. Then we will find or search for the max and min elements in the array. And will return max - min. Example Here is the following code for finding the largest gap in an array in C++. #include using namespace std; ...

Read More

PHP Program to Check if a Number is an Armstrong Number

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 03-Dec-2024 5K+ Views

Armstrong Number Armstrong number is a number in which the sum of its digits raised to the power of the number of digits is equal to the number itself. In this article, we are going to discuss how we can check if a given number is Armstrong number or not. Examples Let's understand Armstrong's Number with the help of some input-output examples. Input 9474 Output Yes Explanation This is a four digit-number. The digit in this number are 9, 4, 7 and 4. 9474 = 94 + 44 + 74 + 44= 6561 + 256 + 2401 + 256= ...

Read More

strdup() and strdndup() in C/C++

karthikeya Boyini
karthikeya Boyini
Updated on 03-Dec-2024 8K+ Views

strdup() The function strdup() is used to duplicate a string. It returns a pointer to a null-terminated byte string. Syntax Here is the syntax of strdup() in C language, char *strdup(const char *string); Example Here is an example of strdup() in C language. #include #include int main() {  char *str = "Helloworld";  char *result;  result = strdup(str);  printf("The string : %s", result);  return 0; } Output The string : Helloworld strndup() The function strndup works similarly to the function strndup(). This function duplicates the string at most size bytes i.e. the given size in the function. It also returns ...

Read More

Structure vs class in C++

Nishtha Thakur
Nishtha Thakur
Updated on 03-Dec-2024 345 Views

In C++ the structure and class are basically the same. But there are some minor differences. These differences are like below. The class members are private by default, but members of structures are public. Let us see these two codes to see the differences. Example Code for Class Here is the following code for the class. #include using namespace std; class my_class {   public:  int x = 10; }; int main() {  my_class my_ob;  cout

Read More

C++ Program to Perform Complex Number Multiplication

Ankith Reddy
Ankith Reddy
Updated on 03-Dec-2024 7K+ Views

Complex numbers are numbers that are expressed as a+bi, where i is an imaginary number and a and b, are real numbers. Some examples of complex numbers are − 2+3i 5+9i 4+2i Example A program to perform complex number multiplication is as follows − #include using namespace std; int main(){  int x1, y1, x2, y2, x3, y3;  cout y1;  cout y2;  x3 = x1 * x2 - y1 * y2;  y3 = x1 * y2 + y1 * x2;  cout

Read More
Showing 2141–2150 of 61,248 articles
« Prev 1 213 214 215 216 217 6125 Next »
Advertisements