Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Course: Programming Fundamentals

In Lab Assignment 8
Date: 27th April, 2013 Lab Instructors: Hafsah Qaiser Rida Nayab, Sobia Bashir

Question 1: Write a program that inputs an integer array of size 10 from the user. And then output the contents of integer array. Question 2: Write a program that inputs an integer array of size 10 from the user and then computes and display the sum of all the elements of the array. Question 3: Write a program that inputs seven numbers from the user and multiplies only the first and last index element of the array and print its multiplication. For example: If the array contains 2,4,5,7,8,1,3 then the program will multiply first index value that is 2 and last index value that is 3 and print 2*3=6 Question 4: Write a program which inputs an array of size 5 and a value from a user. Then the program searches the value in the array and returns the count (number of times the specific element occurs in an array). Question 5: Write a program which inputs five numbers from the user. It finds the sum of all the elements of the array except the largest one and compare whether the sum of all other elements is greater than the maximum or not. Question 6: Given two sets A and B, the union operation gives a new set that contains the elements of both the sets, but no element can be repeated. So given that A={1,4,6,7,9} and B={7,9,10,15} then C=AUB (where U denotes the union operation)={1,4,6,7,910,15}. You have to write program using arrays to represent union of two sets. The size of array A and B must be taken as input from the user.

You might also like