Programming Fundamentals - Spring 2021 Lab 01: Revision: 1D Array
Programming Fundamentals - Spring 2021 Lab 01: Revision: 1D Array
Submission Instructions:
• Submit only CPP files in a single ZIP folder.
• The name of each CPP file should be the question number. E.g., Q1.cpp
• The name of the ZIP folder should be your complete registration number. E.g., L1F20BSSE0000
Task 1
Write a program that takes a number as input and prints the factorial of that number.
Example:
Input: 5
Output: 120
Task 2
Write a program that takes a five-digit number, separates its digits, and save those digits in an array. Print
the array on screen.
Example:
Input: 34125
Output: 3 4 1 2 5
Task 3
Find that whether a given char array of size 5 is palindrome or not.
Example:
Input: tibit
Output: yes
Input: talot
Output: No
Task 4
Write a program which take your name as input and display it on screen.
Example:
Input: Ali
Output: Ali
Task 5
Write a program which take 5 numbers from user and store in an array and display the maximum and
minimum number.
Example:
Input: 1 5 3 4 2
Min: 1
Max: 5
Task 6
Write a C++ program which takes a character array of size 10 as an input from user. Now search vowel
character in the array if character is vowel display it on screen.
Example
Input:
Enter character array: aworldwoniw
Output: a o o i
Task 7
Write a program which takes 10 numbers from user. Take number from a user as input, search it in the
array if found delete the number and sift the array to left so that empty space move to the end.
Example:
Enter numbers: 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
Task 8
Write a program which take your name and find all repeating characters and display them.
Example:
Enter name: ahmad
Output: a
Task 9
Write a program that takes two character arrays and checks if they are same or not.
Example
Input:
Enter character array1: hello
Enter character array1: hello
Output: Both Arrays are same.
Task 10
Write a C++ program that declares an array alpha of 50 components of type double. Initialize the array so
that the first 25 components are equal to the square of the index variable, and the last 25 components
are equal to three times the index variable. Output the array so that 10 elements per line are printed.