Uploaded by Zaib Mahek

ALGORITHM assignment

advertisement
ROLL NO: ADCIT 2013
SUBJECT: COMPUTER FUNDAMENTAL
ASSIGNMENT NO: 2
SUBMITTED TO: SIR SHAMS UR REHMAN
Q NO 1: How would you sort 10 numbers in
increasing order? Do you know any of the
techniques?
ANS: Arranging the 10 numbers in increasing
order:
INPUT:
Numbers are;
23, 65,84,93,76,34,99,44,29,18.
OUTPUT:
18,23,29,34,44,65,76,84,93,99.
Q NO2:How do you test for primarily? You have
given a positive integer, how do you determine that it
is a prime number?
ANS: Given a positive integer, check if the number is prime or
not. A prime number is a natural number greater then ‘1’
that has no positive divisions other than ‘1’ and it self.
FOR EXAMPLE:
INPUT: n=7
OUTPUT: True
INPUT: n=20
OUTPUT: False
INPUT: n=99
OUTPUT: false
Download