algorithm assignment # 02

# algorithm assignment # 02 - TOPIC NAME S/O CLASS SECTION...

This preview shows pages 1–4. Sign up to view the full content.

TOPIC: NAME: ABDUL GHANI SHAHZAIB S/O: MOHAMMED ARIF CLASS: BSCS-I SECTION A BATCH: 2008-2012 SUBJECT: INTRODUCTION TO COMPUTER SCIENCE-I TEACHER: MR. BADAR SAMI DEPARTMENT: COMPUTER SCIENCE DATE: 02-02-2008 INSTITUTE: KARACHI UNIVERSITY

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Q1. Write an Algorithm that takes input three numbers and print the smallest one? Steps of Solution. 1. Problem Statement. 2. Further Specification. 3. Develop Test Cases. 4. Develop Algorithms 5. Trace Tables. 3. Test Cases. 4. Algorithm. Input a Input b b=x Input c If (a<x) x=a If (c<x) x=b Output x 5. Trace Table. Test case no. First no. Second no. Third no. Expected Result. 1 2 4 6 Print 2 2 4 2 6 Print 2 3 6 2 4 Print 2 4 2 2 4 Print 2 5 4 4 6 Print 4 6 6 6 4 Print 4 7 2 6 4 Print 2 8 4 6 2 Print 2 9 6 6 4 Print 4 10 2 2 6 Print 2 11 2 2 2 Print 2 12 6 6 2 Print 2 13 2 4 4 Print 2
case# Step a b c b=x If (a<x) If (c<x) Outpu t x Remarks 1 1 2 2 4 4=x 3 6 4 2<4 yes 5 6<4 no 6 2 Test case # 1 passed 2 1 4 2 2 2=x 3 6 4 4<2 no

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

### Page1 / 8

algorithm assignment # 02 - TOPIC NAME S/O CLASS SECTION...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online