Monday, August 31, 2020

 3.WRITE AN ALGORITHM TO CALCULATE AND DISPLAY OF THE FOLLOWING SERIES : 1/2-2/3+3/4-4/5+5/6.... UPTO N 

 START

STEP 1: Declare the variable n and i as integer. and c as double

STEP 2: Initialize n=c=0 and i=1

STEP 3: Input the value of n

STEP 4: If i<=n then Goto Step 5 else Goto Step 7

STEP 5: If  i %2 =0 then c=c-(i/(i+1))  , Goto Step 6 else c=c+(i/(i+1)) , Goto Step 6

STEP 6 : Increment the value of i by 1 and Goto Step 4

STEP 7 : Display the value of c

END

No comments:

Post a Comment

  3.WAP IN JAVA TO INPUT THREE NUMBERS AND COUNT HOW MANY OF THEM ARE EVEN .   import java.util.*; class Prog {   public static ...