C program to merge two sorted array

Write a C program to input elements in two array and merge two array to third array. How to merge two array in C programming. Logic to merge two sorted array to third array in C program.

Example

Input

Input first array elements: 1, 4, 6, 9, 15
Input second array elements: 2, 5, 8, 10

Output

Merged array in ascending order = 1, 2, 4, 5, 6, 8, 9, 10, 15

Read more

C program to count negative elements in array

Write a C program to input elements in array and count negative elements in array. C program to find all negative elements in array. How to count negative elements in array using loop in C programming. Logic to count total negative elements in an array in C program.

Example

Input

Input array elements : 10, -2, 5, -20, 1, 50, 60, -50, -12, -9

Output

Total number of negative elements: 5

Read more

C program to print all negative elements in array

Write a C program to input elements in array and print all negative elements. How to display all negative elements in array using loop in C program. Logic to display all negative elements in a given array in C programming.

Example

Input

Input array:
-1
-10
100
5
61
-2
-23
8
-90
51

Output

Output: -1, -10, -2, -23, -90

Read more

C program to delete duplicate elements from array

Write a C program to delete duplicate elements from array. How to remove duplicate elements from array in C programming. After performing delete operation the array should only contain unique integer value. Logic to delete duplicate elements from array.

Example

Input

Input array elements: 10, 20, 10, 1, 100, 10, 2, 1, 5, 10

Output

After removing all duplicate elements
Elements of array are: 10, 20, 1, 100, 2, 5

Read more

C program count total duplicate elements in array

Write a C program to input elements in array from user and count duplicate elements in array. C program to find all duplicate elements in an unsorted array. How to count duplicate elements in array using loop in C programming.

Example

Input

Input array elements: 1, 10, 20, 1, 25, 1, 10, 30, 25, 1

Output

Total number of duplicate elements = 5

Read more

C program to delete element from an array

Write a C program to delete element from array at specified position. How to remove element from array at given position in C programming. Logic to remove element from any given position in array in C program. The program should also print an error message if the delete position is invalid.

Example

Input

Input array elements: 10 20 30 40 50
Input position to delete: 2

Output

Array elements: 10, 30, 40, 50

Read more

C program to insert an element in array

Write a C program to insert element in array at specified position. C program to insert element in array at given position. The program should also print an error message if the insert position is invalid. Logic to insert an element in array at given position in C program.

Example

Input

Input array elements: 10, 20, 30, 40, 50
Input element to insert: 25
Input position where to insert: 3

Output

Elements of array are: 10, 20, 25, 30, 40, 50

Read more

C program to copy all elements of one array to another

Write a C program to input elements in array and copy all elements of first array into second array. How to copy array elements to another array in C programming. Logic to copy array elements in C program using loop.

Example

Input

Input array1 elements: 10 1 95 30 45 12 60 89 40 -4

Output

Array1: 10 1 95 30 45 12 60 89 40 -4
Array2: 10 1 95 30 45 12 60 89 40 -4

Read more

C program to find maximum and minimum element in array

Write a C program to input elements in an array from user, find maximum and minimum element in array. C program to find biggest and smallest elements in an array. Logic to find maximum and minimum element in array in C programming.

Example

Input

Input array elements: 10, 50, 12, 16, 2

Output

Maximum = 50
Minimum = 2

Read more

C program to find sum of array elements

Write a C program to read elements in an array and find the sum of array elements. C program to find sum of elements of the array. How to add elements of an array using for loop in C programming. Logic to find sum of array elements in C programming.

Example

Input

Input elements: 10, 20, 30, 40, 50

Output

Sum of all elements = 150

Read more