cs106-ps4

Upload: asadhppy

Post on 14-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 CS106-PS4

    1/3

    CS106 Programming Fundamentals

    Submission Instructions Submission by email to [email protected] or

    [email protected] Subject of the email should be CS106-PS4-YourName-RegNo No collaboration allowed. Due Date : 19 th 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 twoterms. 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 2Find sum of all the primes less than n where n is a constant variable in yourcode . 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 nwhere n is a constant variable in your code. You have to fill random data as yearsof 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

    mailto:[email protected]:[email protected]:[email protected]:[email protected]:[email protected]://en.wikipedia.org/wiki/Leap_yearhttp://en.wikipedia.org/wiki/Leap_yearhttp://en.wikipedia.org/wiki/Leap_yearmailto:[email protected]:[email protected]
  • 7/29/2019 CS106-PS4

    2/3

  • 7/29/2019 CS106-PS4

    3/3