Wednesday 16 November 2016

Write a program that displays the sum of the following series using do-while loop. 1+ 1/4 + 1/8 + ........ + 1/100


Write a program that displays the sum of  the following series using do-while loop.
                  1+ 1/4 + 1/8 + ........ + 1/100

Solution : 


      
        #include <iostream.h>
        #include <conio.h>
        #include<iomanip.h> 


        int main ()
        {

              clrscr();
             float  c , r;
             c = 4.0      
             r = 1.0 ;
             
                do
               {
                      r = r + 1.0 ;
                      c = c + ;
               }while ( c <= 100 );

                cout <<  "Result : " << r ;
                return 0;
        }


Output:


1 comment:

If you have any doubt please let me know

Methods in JAVA Language

 In general, a way may be thanks to perform some task. Similarly, the tactic in Java may be a collection of instructions that performs a sel...