Professional Documents
Culture Documents
Assignment No 1
Due Date: 30th Oct, 2017
Assignment 2
Due Date: 11th March, 2014
Instructions:
Please submit your assignment on/before the due date. No assignment
will be accepted after the due date.
Assignment would be marked as zero without any explanation, if it is
found to be copied.
Print a table that shows the approximate value of after each of the first 1,000 terms of this
series
term pi
1 4.00000000
2 2.66666667
3 3.46666667
4 2.89523810
5 3.33968254
6 2.97604618
7 3.28373848
8 3.01707182
9 3.25236593
10 3.04183962
...
990 3.14058255
991 3.14260174
992 3.14058459
993 3.14259970
994 3.14058662
995 3.14259768
996 3.14058864
997 3.14259566
998 3.14059065
999 3.14259365
1000 3.14059265
Question 3: Write a program that prints the prime numbers from 1 to 1000.
Question 4: Write a program to print Fibonacci series till the nth term, where n
is input by user : 0 1 1 2 3 5 8 13 24 .....
Question 5: Write a program that uses for statements to print the following
patterns separately, one below the other. Use for loops to generate the patterns.
All asterisks (*) should be printed by a single statement of the form cout << '*';.
[Hint: The last two patterns require that each line begin with an appropriate
number of blanks.
(a) (b) (c)
********** ********** *
********* ********* **
******** ******** ***
******* ******* ****
****** ****** *****
***** ***** ******
**** **** *******
*** *** ********
** ** *********
* * **********