Thursday, December 26, 2013

Assignment 2.3: flow of control Set 3

Flow of Control
[SET – 3]

1
Write a program to print following : solution

i)
********************
**********
**********
ii)
***
***
****
*****
iii)
        *      **
    ***
  ****
*****


iv)
        *      ***
    *****
  *******
*********
v)
        1
      222
    33333
  4444444
555555555
vi)
        1
      212
    32123
  4321234
543212345

2
Write a program to compute sinx for given x. The user should supply x and a positive integer n. We compute the sine of x using the series and the computation should use all terms in the series up through the term involving xn
sin x = x - x3/3! + x5/5! - x7/7! + x9/9! ........ solution
3
Write a program to compute the cosine of x. The user should supply x and a positive integer n. We compute the cosine of x using the series and the computation should use all terms in the series up through the term involving xn
cos x = 1 - x2/2! + x4/4! - x6/6! ..... solution

No comments:

Post a Comment