Array Problem Set
Array Problem Set
1. Write a c program, declare an array with a size of 5. Store 10, 20, 30, 40 and 50 in it and
print them as output.
Input output
10, 20, 30, 40, 50
Input output
Size of the array: 5
3. Write a C program to take input from user and store them in an array. Take 4 even years
as input.
Input output
2000 2000
2002 2002
2004 2004
2006 2006
Input output
Enter array size: 10 Your elements: 4 12 7 19……….
element-1: 4
element-2:12
element-3:7
element-4:19
…………..
5. Write a C program to take 7 value from user in an array. Use a loop to input those values
from user. As output print those values.
Input output
5 Inputted values:
10 5
15 10
20 15
25 20
30 25
35 30
35
6. Write a C program to take 7 values from user in an array. Now input values in that array
and print the values in reverse order.
Input output
5 Inputted values:
10 35
15 30
20 25
25 20
30 15
35 10
5
7. Write a C program to take 5 character (vowels) from user as input in an array. Use a loop
to input those character from user. As output print them.
Input output
A Vowels:
E A
I E
O I
U O
U
8. Write a c program to take input n times. Here the value of n will be user defined. As
output print the inputted values.
Input output
Enter array size: 3 Your values:
4 4
5 5
6 6
9. Write a c program to take 10 user input in an array and print the sum of those 10 values.
Input output
Enter array size: 10 Sum = 348
13
17
5
8
….
35
10. Write a C program that would calculate the average of all the elements in an array.
13. Write a program in C to find the maximum and minimum element in an array.
Input output
Array size = 10 Maximum: 55
55 Minimum: 13
23
20
13
……
14. Write a C program that would find the difference between the minimum and the
maximum number in an array
17. Write a program in C to separate odd and even integers in separate arrays.
Input output
Input array size: 5 The Even elements are :
Input elements in the array : 42 56 32
element - 1 : 25 The Odd elements are :
25 47
element - 2 : 47
element - 3 : 42
element - 4 : 56
element - 5 : 32
18. Write a C program that would only print the sum of all the even numbers in an array.
Sample Input Sample Output
19. Write a C program that would count the even numbers in an array.