Академический Документы
Профессиональный Документы
Культура Документы
Submission by email to raza.rehman@abasyn.edu.pk or razaurrehman@gmail.com Subject of the email should be CS106-PS4-YourName-RegNo No collaboration allowed. Due Date : 19th Nov 9 am You should send cpp files with names Task1.cpp, Task2.cpp in one zip file
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find that how many even, odd and prime values are there in first n Fibonacci Series elements, where n is a constant variable in your code. Max value of n can be 999.
Task 2
Find sum of all the primes less than n where n is a constant variable in your code. Max value of n can be 999.
Task 3
Make a program to store the years of birth of all the members of a class of size n where n is a constant variable in your code. You have to fill random data as years of birth but you have to make sure that the year of birth must be in the range of 1980 to 2000. Find out how many of your class fellows were born in a leap year http://en.wikipedia.org/wiki/Leap_year
Task 4
Make a program to store n random numbers where n is a constant variable in your code. Take another input x , making sure that x consists of only one digit. You are required to tell that in how many and which random numbers x occurs as a digit. Max value of n can be 999. For example If n=5 and random numbers are 110, 154, 135, 157, 299 And x =3 Then your program should output that 3 occurs in one number i.e. 135
Task 5
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. ! is the factorial. Print out all the curious numbers less than n where n is a number entered by the user. Max value of n can be 999.
Bonus Question
Bonus part: Can you calculate time taken by your programs (Task 1 to Task 5) given that n varies as 100,200,300,400, 500. Can you draw a graph for time taken vs input size in Excel? ( you should email excel graph to me as well) Hint: time function can help you in time calculation