Cover Image Alpine example code

Access AlpineJS x-data variable outside scope

I was big fan of jQuery before I started using AlpineJS!. Alpine is so easy and seamless that I fell in love with it instantly. One more thing that you might want to consider is its size. Alpine is very small in comparison of jQuery, Vue, Angular etc. Alpine was previously called Tailwind of JavaScript. If you don’t know about Tailwind, Man you should read it. If you wanted to learn about AlpineJS basics and other concepts click here....

July 24, 2021 · 3 min · Rahul Rajput

Second Equation of motion in C language

The second equation of motion is used to calculate the displacement of an object under constant acceleration. Algorithm Without wasting any of your precious time let’s try to understand how second equation of motion is implemented The second equation of motion is s = u*t + 1/2 * a * t * t s: total displacement u: initial velocity t: time taken by the journey a: constant acceleration We are considering u=0 if you want you can set initialVelocity variable value as per your choice, or you can ask it from user....

February 12, 2020 · 2 min · Rahul Rajput

Third Equation of motion using C language

The third equation of motion is used to deduce the relation between initial velocity, final velocity, displacement, and acceleration without time. Algorithm Without wasting any of your precious time let’s try to understand how this algorithm is implemented. Third equation of motion is v * v = u * u + 2 * a * s s: total displacement u: initial velocity v: final velocity a: constant acceleration In function CalculateDisplacement, we are calculating the value of displacement....

February 11, 2020 · 2 min · Rahul Rajput

First Equation of motion implementation in C

The first equation of motion is used to calculate the final velocity of an object under constant acceleration. Algorithm Without wasting any of your precious time let’s try to understand how the algorithm is implemented. The first equation of motion is v = u + a * t u: initial velocity t: time taken by the journey a: constant acceleration as you can see in our program we are considering u=0 if you want you can set initialVelocity variable value as per your choice or you can ask it from user too, accel=5 and timeOfJourney=7....

February 2, 2020 · 2 min · Rahul Rajput

Bubble sort code in Python

Bubble sort is the simplest Sorting algorithm available. It works by repeatedly swapping the adjacent or neighbor element if they are in the wrong order. Working Actually in the first-pass bubble sort sets the largest element to its position, in the second pass algorithm sets the second largest element this continues till the list or array is not finally sorted. Here is the example image. To work with the algorithm you first have to understand what is swapping and how it is done....

November 17, 2019 · 2 min · Rahul Rajput

Python program to display Fibonacci using recursion

TLDR; In post we are going to learn how to create a fibonacci series program using recursion in python. If you are looking for code only, you can find it Here Fibonacci series Explanation The Fibonacci series is the special sequence of numbers in which next number is calculated using a formulae. first two numbers are default 0 and 1. Formula is n2 = n1 + n0 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …...

April 27, 2019 · 3 min · Rahul Rajput

Creating Square, Rectangle using * in C

In the process of learning the basic of C language people often create shapes using the *, and these shapes question are also asked in the interview question and selection exam of various companies so it is very good to learn how to make various shapes. Rectangle we can also make multiply. Multiply Code for the above images it is in the order of images. #include <iostream> using namespace std; int main() { int size; cout << "Enter Number "; cin >> size; cout << endl; for(int i=0;i<size;i++){ for(int j=0;j<size;j++){ cout << "*"; } cout << endl; } cout << endl; for(int i=0;i<size;i++){ for(int j=0;j<size;j++){ if(i == j) cout << "*"; else cout << " "; } cout << endl; } cout << endl; for(int i=0;i<size;i++){ for(int j=0;j<size;j++){ if( (size - i - 1) == j) cout << "*"; else cout << " "; } cout << endl; } cout << endl; for(int i=0;i<size;i++){ for(int j=0;j<size;j++){ if( (size - i - 1) == j || i == j) cout << "*"; else cout << " "; } cout << endl; } cout << endl; for(int i=0;i<size;i++){ for(int j=0;j<size;j++){ if(i==0 || i == (size -1)) // printing for the first and last line cout << "*"; else if((j == 0 && i !...

April 27, 2019 · 2 min · Rahul Rajput