# Programming Videos

## Search

### Write a Program to Move all Zeros to End of an Array

Given an array of random numbers, Write a c code to move all zeros to end of an array. An array contains only positive number.

For example -

Input

`int arr[] = {1,6,0,3,8,9,0,2};`

Output

// Move all zero at the end

`int arr[] = {1,6,3,8,9,2,0,0};`

### C Program to Calculate Power of a Number using For & While Loop

Write a c program to calculate power of a number using for & while loop without using inbuilt pow() function.

In this tutorial, You are going to learn  how to calculate power of a number without using pow() function. In this program, we take two numbers (base and exponent) as an input from a user and calculate it's result which is (baseexponent).

For example -

Input number (base) : 2

Input power (exponent) : 3

Result : 23 = 8 (2 * 2 * 2).

### C Program to Delete an Element from an Array

Write a c program to delete an element from an array at specified position. In this program, we take an input array and position to delete an array element from a user. Then we check whether a position entered by user is valid or not.

All elements of an array are stored in a contiguous memory location. To delete an element at index i in an array, We have to shift all elements from index i+1 to i to previous index.

For example - Take an array of length 5 and suppose we have to delete an element at index 3.

arr[] - {3, 8, 2, 7, 1}

position to delete an element : 3

To delete an element, we have to move element at position 4 to 3 and position 5 to 4. Then we can decrement the size of an array.

### C Program to Insert an Element in an Array

Write a c program to insert an element in an array. In this tutorial, we are going to write a c program which insert an element in an array at a given index.

This question is also very important in terms of an interview.

In this program, we are going to write a c code which takes an input array, position and value of a new element from a user and insert it at a specified position.

For example -

Input array - {4, 3, 1, 5}

Input position - 3

New element - 7

After inserting an element - {4, 3, 7, 1, 5}

### Find Smallest Number in Array - C, C++ Code C, C++ Program to Print Smallest Element of an Array
Write a C, C++ program to find smallest number in an array. Given an unsorted array, we have to write a code to print smallest number of an array.

To understand this problem,  Let's take an array arr[] = {3, 4, 1, 5, 6}. The smallest number in an array is 1.

Now the question is how to solve this problem. You can use multiple approaches to solve this problem.