Write a program in which users enter 5 numbers using for loop and all these numbers will store in an array.

By: Prof. Dr. Fazal Rehman | Last updated: February 3, 2024

Write a program in which users enter 5 numbers using for loop and all these numbers will store in an array. After that program will add these five numbers and show the result. Your program must support the concept of operator overloading.

Output

Enter element 1: 1
Enter element 2: 2
Enter element 3: 3
Enter element 4: 4
Enter element 5: 5
Enter element 1: 6
Enter element 2: 7
Enter element 3: 8
Enter element 4: 9
Enter element 5: 7
Resultant array after adding two arrays: 7 9 11 13 12
Enter a number to add to the array: 6
Resultant array after adding a number to the array: 7 8 9 10 11
Resultant array after adding a number to the array: 12 13 14 15 13

 

All Copyrights Reserved 2025 Reserved by T4Tutorials