program to print prime number in JavaScript

// program to check if a number is prime or not // take input from the user const number = parseInt(prompt(“Enter a positive number: “)); let isPrime = true; // check if number…

Read more
python logo

Example: Integer Value Between Two Numbers

If you want to find a random integer in between min (inclusive) to max (inclusive), you can use the following formula: Math.floor(Math.random() * (max – min + 1)) + min // input from the user const min…

Read more

Python program to print a pathlib module

Example 1: Using pathlib module import pathlib # path of the given file print(pathlib.Path(“my_file.txt”).parent.absolute()) # current working directory print(pathlib.Path().absolute()) Output /Users/username /Users/username Using the pathlib module, you can get the current working directory. Pass the…

Read more
python logo

Python Program to Print Natural Numbers in Reverse Order

Write a Python Program to Print Natural Numbers in Reverse Order with an example. Python Program to Print Natural Numbers in Reverse Order using While Loop This Python program allows users to enter any integer value….

Read more
python logo

Python Program to Add two Lists

Write a Python Program to add two Lists (list items) using For Loop and While Loop with a practical example. Python Program to Add two Lists Example In this python program, we are…

Read more
python logo

Python Program to find Strong Number

Write a Python Program to find Strong Number using While Loop, For Loop, and factorial function with an example. Python Program to find Strong Number using While Loop This python program for a strong number allows…

Read more
Python-logo

Python Fibonacci Series program

How to Write Python Fibonacci Series program using While Loop, For Loop, and Recursion?. As per Mathematics, Python Fibonacci numbers, or Fibonacci series in Python are 0, 1, 1, 2, 3, 5, 8,…

Read more
python logo

Python Program to Print Hollow Rhombus Star Pattern

Write a Python Program to Print Hollow Rhombus Star Pattern using for loop. The nested for loop and if else statements help to print the hollow rhombus pattern. # Python Program to Print…

Read more
python logo

Python Program to find Rhombus Perimeter

Write a Python Program to find the Perimeter of a Rhombus with an example. This Python example allows the Rhombus side and calculates the Rhombus perimeter. # Python Program to find Rhombus Perimeter…

Read more
python logo

Python Program to Print Even Numbers in Set

Write a Python Program to Print Even Numbers in a Set. The if statement (if(val % 2 == 0)) tests whether the Set item is divisible by two returns zero. If True, print…

Read more