# Category Archives: School Programming

## Arc length from given Angle

An angle is a geometrical figure when two rays meet at a common point on a plane. These rays form the sides of the angle… Read More »

## Area of a Circular Sector

A circular sector or circle sector is the portion of a disk enclosed by two radii and an arc, where the smaller area is known… Read More »

## Co-prime pair with given sum minimum difference

Co-prime or mutually prime pair are those pair of numbers whose GCD is 1. Given a number n represent the number as the sum of… Read More »

## Find n-th term in the series 7, 15, 32, …

Given a series 7, 15, 32, …… Find the nth term of this series. Examples : Input : 5 Output : 138 Input : 7… Read More »

## Number of co-prime pairs in an array

Co-prime or mutually prime pair are those pair of numbers whose GCD is 1. Given an array of size n, find number of Co-Prime or… Read More »

## Check if the product of digit sum and its reverse equals the number or not

Given a number, check whether the product of digit sum and reverse of digit sum equals the number or not. Examples: Input : 1729 Output… Read More »

## Program to print hollow pyramid and diamond pattern

Prerequisite : Loops, If Else Statement 1. Hollow pyramid/triangle pattern The pattern is similar to pyramid pattern. The only difference is, we will replace all… Read More »

## Program to find gravitational force between two objects

Introduction to Gravitational Force We know that gravity is universal. According to Newton’s Law of Universal Gravitation, all objects attract each other with a force… Read More »

## Program for harmonic mean of numbers

Given an array of elements, find harmonic mean of numbers. Examples: Input : arr[] = {2.0, 1.0} Output : 1.3333 Harmonic mean = 2/(1/2.0 +… Read More »

## Divide every element of one array by other array elements

Given two arrays and the operation to be performed is that the every element of a[] should be divided by all the element of b[]… Read More »

## Program for product of array

Given an array, find product of all array elements. Examples : Input : ar[] = {1, 2, 3, 4, 5} Output : 120 Product of… Read More »

## Count number of even and odd elements in an array

For the given array of integers, count even and odd elements. Examples: Input : int arr = {2, 3, 4, 5, 6} Output : Number… Read More »

## Find the first, second and third minimum elements in an array

Find the first, second and third minimum elements in an array in O(n). Examples: Input : 9 4 12 6 Output : First min =… Read More »

## Program to print a rectangle pattern

Given height h and width w, print a rectangular pattern as shown in example below. Examples: Input : h = 4, w = 5 Output… Read More »

## Program to find compound interest

What is ‘Compound interest’? Compound interest is the addition of interest to the principal sum of a loan or deposit, or in other words, interest… Read More »