Find sum of array elements
// Find the sum of array elements.#include <stdio.h>#include <conio.h>#include<math.h>void main(){ int a[5], i, sum; // Assigning values to array. printf("Enter Enter t...
NOTE: The following program is written in python.
Ever heard about Josephus problem, if not then here's a brief description:
Josephus Problem
The Problem:
People are standing in a circle, waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a specified direction. After a specified number of people are skipped, the next person is executed. The procedure is repeated with the remaining people, starting with the next person, going in the same direction and skipping the same number of people, until only one person remains, and is freed.
Solution:
no_of_people = int(input("What is the number of people ? "))