Pavitra has Published 177 Articles

Python Program for Find largest prime factor of a number

Pavitra

Pavitra

Updated on 26-Sep-2019 07:16:48

3K+ Views

In this article, we will learn about the solution to the problem statement given below −Problem statementGiven a positive integer n. We need to find the largest prime factor of a number.ApproachFactorise the given number input by dividing it with the divisor of a number.Now keep updating the maximum prime ... Read More

Python Program for Fibonacci numbers

Pavitra

Pavitra

Updated on 25-Sep-2019 14:18:17

394 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −Our task to compute the nth Fibonacci number.The sequence Fn of Fibonacci numbers is given by the recurrence relation given belowFn = Fn-1 + Fn-2with seed values (standard)F0 = 0 and F1 ... Read More

Python Program for Difference between sums of odd and even digits

Pavitra

Pavitra

Updated on 25-Sep-2019 13:20:27

402 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −Given an integer, we need to calculate if the difference between the sum of odd digits and sum of even digits is 0 or not.The brute-force approach will be calculating the sum ... Read More

Python Program for cube sum of first n natural numbers

Pavitra

Pavitra

Updated on 25-Sep-2019 13:16:16

2K+ Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −Given an input n, we need to print the sum of series 13 + 23 + 33 + 43 + …….+ n3 till n-th term.Here we will discuss two approach to reach ... Read More

Python Program for compound interest

Pavitra

Pavitra

Updated on 25-Sep-2019 13:13:09

400 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −We are given with three input values i.e principle, rate & time and we need to compute compound interest.The code given below shows the process of computation of compound interest.The formula used ... Read More

Python Program for Bubble Sort

Pavitra

Pavitra

Updated on 25-Sep-2019 12:59:03

1K+ Views

In this article, we will learn about the implementation of bubble sort sorting technique.The figure shown below illustrates the working of this algorithm −ApproachStarting with the first element(index = 0), compare the current element with the next element of the array.If the current element is greater than the next element ... Read More

Python Program for Binary Search

Pavitra

Pavitra

Updated on 25-Sep-2019 12:50:04

6K+ Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement − We will be given a sorted list and we need to find an element with the help of a binary search.AlgorithmCompare x with the middle element.If x matches with the middle ... Read More

Python Program to calculate the area of a Tetrahedron

Pavitra

Pavitra

Updated on 25-Sep-2019 12:37:59

285 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −Given the side of a tetrahedron, we need to find a tetrahedron.A Tetrahedron is a geometric figure which looks like a pyramid with a triangular base. It is a solid object with ... Read More

Python Program to Print Matrix in Z form

Pavitra

Pavitra

Updated on 25-Sep-2019 12:26:13

279 Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −Given a square matrix of order n*n, we need to display elements of the matrix in Z form.Z form is traversing the matrix in the following steps −Traverse the first rowNow, traverse ... Read More

Python Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!

Pavitra

Pavitra

Updated on 25-Sep-2019 12:21:44

2K+ Views

In this article, we will learn about the solution and approach to solve the given problem statement.Problem statement −Given an integer input n, we need to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!Here we are implementing for loop, therefore, we get O(n) ... Read More

Advertisements