PDF Archive

Easily share your PDF documents with your contacts, on the Web and Social Networks.

Share a file Manage my documents Convert Recover PDF Search Help Contact



SP13 Lab 6 Quizzes.pdf


Preview of PDF document sp13-lab-6-quizzes.pdf

Page 1 2 3 4 5 6

Text preview


2

3

Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

4

5

0

Section 12

Write a program that reads from the user a size and creates an array with this size then enter its values.
The program should try to add each two numbers in the array together and displays their sum
Sample execution:
Enter number of elements
3
Enter 3 elements
157
Sum of 1, 5 is 6
Sum of 1, 7 is 8
Sum of 5, 7 is 12

Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 13

Write a program to count number of smaller elements on right of each element in an array. Given an
unsorted array arr[] of distinct integers, construct another array countSmaller[] such that
countSmaller[i] contains count of elements less than arr[i] on the right side of arr[i] in the array. Note
that you have to take first the number of elements from the user.
Sample execution:
Input: 7
12, 1, 2, 3, 0, 11, 1
Output: 6, 1, 2, 2, 0, 1, 0

Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 14

Write a program that represents a point as a structure of x and y coordinates. Define a triangle as a
shape that consists of three points, The program is required to read from the user the coordinates of
the three points of the triangle, then check if that triangle has two equal edges.