Python program to convert time from 12 hour to 24 hour format

Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note : Midnight is 12:00:00 AM on a 12-hour clock and 00:00:00… Read More »

PHP programs for printing pyramid patterns

This article is aimed at giving a PHP implementation for pattern printing. Simple Pyramid Pattern filter_none edit close play_arrow link brightness_4 code <?php // Php… Read More »

Finding n-th term of series 3, 13, 42, 108, 235…

Given a number n, find the n-th term in the series 3, 13, 42, 108, 235… Examples: Input : 3 Output : 42 Input :… Read More »

Program for sum of cos(x) series

Given n and b, where n is the number of terms in the series and b is the value of the angle in degree. Program… Read More »

Program for scalar multiplication of a matrix

Given a matrix and a scalar element k, our task is to find out the scalar product of that matrix. Examples: Input : mat[][] =… Read More »

Find array elements that are greater than average

Given an array of numbers, print all those elements that are greater than average. Examples: Input : 5, 4, 6, 9, 10 Output : 9… Read More »

Program to calculate value of nCr

Following are common definition of Binomial Coefficients. A binomial coefficient C(n, k) can be defined as the coefficient of X^k in the expansion of (1… Read More »

Sum of digits written in different bases from 2 to n-1

Given a number n, find the sum of digits of n when represented in different bases from 2 to n-1. Examples: Input : 5 Output… Read More »

Prime String

Given a String str , the task is to check if the sum of ASCII value of all characters is a Prime Number or not.… Read More »

Types of Operating Systems

An Operating System performs all the basic tasks like managing file,process, and memory. Thus operating system acts as manager of all the resources, i.e. resource… Read More »

Program to check if first and the last characters of string are equal

We are given a string, we need check whether the first and last characters of the string str are equal or not. Case sensitivity is… Read More »

Given equation of a circle as string, find area

Given an equation of the circle X2 + Y2 = R2 whose center at origin (0, 0) and the radius is R. The task is… Read More »

Perfect Square String

Given a String str and the task is to check sum of ASCII value of all characters is a perfect square or not. Examples :… Read More »

Reaching a point using clockwise or anticlockwise movements

Given starting and ending position and a number N. Given that we are allowed to move in only four directions as shown in the image… Read More »