## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

• 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

**Problem Set 4 (Arrays)
**

Task 1

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

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

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 .200. 157. ! is the factorial. 135 Task 5 145 is a curious number. For example If n=5 and random numbers are 110. 154. as 1! + 4! + 5! = 1 + 24 + 120 = 145.e. You are required to tell that in how many and which random numbers x occurs as a digit.300. Take another input x . Max value of n can be 999. 500. 299 And x =3 Then your program should output that 3 occurs in one number i.400. Task 4 Make a program to store n random numbers where n is a constant variable in your code. Bonus Question Bonus part: Can you calculate time taken by your programs (Task 1 to Task 5) given that n varies as 100. Max value of n can be 999. Print out all the curious numbers less than n where n is a number entered by the user. making sure that x consists of only one digit.Max value of n can be 999. 135.

2. 15. Prefer plain char over signed char and unsigned char. 10. 17.10 of Bjarne Stroustrup.” 3rd Edition. 13. View signed to unsigned and unsigned to signed conversions with suspicion. 9. Avoid unsigned arithmetic. Remember that every declaration must specify a type (there is no ‘‘implicit int”) 11. Avoid making unnecessary assumptions about the sizes of objects. Avoid unnecessary assumptions about the size of integers. 5. 14. 19. 4. Prefer a double over a float or a long double. “C++ Programming Language. Maintain a consistent naming style. 16. 6. 18. Avoid similar-looking names. View floating-point to integer conversions with suspicion. Use a typedef to define a meaningful name for a built-in type in cases in which the built-in type used to represent a value might change. 3. develop habit to declare and initialize the variable at the same time. 8. use enumerations and classes to define new types. Prefer a plain int over a short int or short or a long int or a long. Keep common and local names short.Tips &Tricks/ Advice/Recommendations/Additional References Advice (taken from Section 4. Don’t use the same name in both a scope and an enclosing scope. Declare one name (only) per declaration. 2000. Another important thing. with suspicion. 20. 12. Avoid unnecessary assumptions about the range of floating-point types. View conversions to a smaller type.) 1. Choose names carefully to reflect meaning rather than implementation. . 21. Use typedefs to define synonyms for types. such as int to char. Keep scopes small. 7. and keep uncommon and nonlocal names longer. Avoid unnecessary assumptions about the numeric value of characters.

- Level 2
- Variables and User Input
- Download 10 CPP Programs
- DLX-ISA
- Fibonacci One
- Computer Java
- 308134317holyday_hm
- physical-computing-end-assignment
- Byte Order 1
- Week-2 CS F111c programming
- Csharp Data Types(6)
- Lesson 1
- 960702B Communicating With Allen Bradley Programmable Logic Controllers
- 090916.dm.Root1
- Lab-DataTypes-Worksheet.pdf
- EffoDesign_LockFree
- Computer Programming
- sheet5.docx
- C Lecture1
- AWE Flyer Aurora IL Jan 30-31-2016
- Variables
- C++
- It Ec 114 Assignment 1
- Project 3
- Quantlib Exercises
- BW note
- 14.docx
- clocksbuzzercode
- Turbo C++ Module
- Lecture 15

- CS125 - Lab 12 - Inheritance
- Data Structure - Assignments.doc
- CS125 - Lab 11 - String-Class
- CCN_Mid_term_1.docx
- CS125 - Lab 02 - Data Types and Variables
- CS125 - Lab 13- Templates, STL and Lists -.pdf
- SRS-v1.2.doc
- CS125 - Lab 10 - Vector-Class
- OOP-Lecture-01.pptx
- CS125 - Lab 12 - Inheritance
- CS125 - Lab 01 - Programing Basics
- CS125 - Lab 09 - Classes
- CS125 - Lab 08 - Structures
- GAP Research Compendium Charter.doc
- hunspell.pdf
- Data Structures
- Csc441 Quiz 1
- Learn MVC.docx
- 03 Introducing the STL
- Ubuntu User Guide
- C# Projects.docx
- Edmodo Teacher Guidev4-5-12.pdf
- Csc261 Ccn Lab Manual
- How to make software.pdf
- Beej's Guide to Network Programming Using Internet Sockets
- Hun Spell
- On Peer-To-peer Client Web Cac
- CS106 PS3
- Callback Implementations in C++.pdf

Sign up to vote on this title

UsefulNot usefulClose Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading