ITC LAB ASSIGNMENT
Assignment no 3
Name:
Ayla tahir
Roll no:
07
Submitted to:
Prof.Amjad
Deadline: 11-02-2025
Final 20 C++ Programs
Assignment: Arrays, Loops, and Selection Statements in C++
💡 Instructions: Implement the following programs using arrays, loops, and selection
statements (if-else, switch-case).
1. Store and Display Array Elements
Take 10 numbers in an array and print them using a loop.
ITC LAB ASSIGNMENT
2. Find Maximum and Minimum
Find and display the maximum and minimum numbers from an array of 10 elements.
ITC LAB ASSIGNMENT
3. Count Even and Odd Numbers
Count how many numbers are even and odd in an array of size 10.
ITC LAB ASSIGNMENT
4. Search for a Number (Linear Search)
ITC LAB ASSIGNMENT
Search for a user-entered number in an array and display its position if found.
5. Reverse an Array
Take 10 numbers in an array and display them in reverse order.
6. Sum of Array Elements
Find the sum of all numbers in an array of 10 elements.
ITC LAB ASSIGNMENT
7. Count Positive, Negative, and Zero Numbers
Count how many numbers are positive, negative, and zero in an array of 10 elements.
ITC LAB ASSIGNMENT
8. Grade Calculation Based on Marks
Store marks of 5 students and assign grades (A, B, C, D, Fail) based on their marks.
9. Check for Prime Numbers in an Array
ITC LAB ASSIGNMENT
Identify prime numbers from an array of 10 elements.
10. Find the Second Largest Number
Identify the second largest number from an array.
ITC LAB ASSIGNMENT
11. Count the Frequency of a Specific Number
Count how many times a specific number appears in an array of 10 elements.
ITC LAB ASSIGNMENT
12. Sort an Array in Ascending Order
Sort a given array in ascending order (smallest to largest).
ITC LAB ASSIGNMENT
13. Identify Even and Odd Numbers (Using If-Else)
Display even and odd numbers separately using an if-else condition.
ITC LAB ASSIGNMENT
14. Identify Leap Years from an Array
Take 5 years in an array and determine which ones are leap years.
ITC LAB ASSIGNMENT
15. Find and Replace Negative Numbers with Zero
Replace all negative numbers in an array with zero.
ITC LAB ASSIGNMENT
16. Find and Display Duplicate Elements
Identify and display duplicate numbers in an array.
ITC LAB ASSIGNMENT
17. Rotate an Array Left or Right
Shift all array elements one position to the left or right.
18. Menu-Driven Program for Array Operations (Using Switch-Case)
Display a menu with the following options and execute the chosen task:
1. Find Maximum
ITC LAB ASSIGNMENT
2. Find Minimum
3. Search for a Number
4. Exit
ITC LAB ASSIGNMENT
19. Convert Uppercase to Lowercase in a Character Array
Convert all uppercase letters in a character array to lowercase.
ITC LAB ASSIGNMENT
20. Find the First and Last Digit of Each Number
Extract and display the first and last digits of each number in an array.
ITC LAB ASSIGNMENT