Answers

2015-01-23T13:21:41+05:30
A1
class Numbers
{
     public static void main(String args[])
    {
      int n ;
      for (int i = 1 ; i <= 100 ; i++)
      {
         System.out.println(n) ;
      }
    }
}
A2
class Series_6
{
    public static void main (String args[])
    { 
       int s = 0 , i ;
       for(i = 1 ; i <= 19 ; i++)
        {
            s = s + (i * (i + 1)) ;
        } 
       System.out.println("The sum of the given series = " + s) ; 
   }
}
A3
import java.io.* ;
class Series_1
{
    public static void main (String args[])throws IOException
    { 
       int s = 0 ,n, i ;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the value of n") ;
n = Integer.parseInt(br.readLine());
       for(i = 1 ; i <= n ; i++)
        {
            s = s + (i / (i + 1)) ;
        } 
       System.out.println("The sum of the given series = " + s) ; 
   }
}
A5
import java . io . * ;
class Series_5
{
    public static void main ()throws IOException
    {
        double s = 0 , n , i , a ;
 BufferedReader br = new BufferedReader ( new InputStreamReader (System.in) ) ;
        System.out.println("Enter the number of terms : ") ;
        n = Double.parseDouble(br.readLine()) ;
        System.out.println("Enter the value of 'a'    : ") ;
        a = Double.parseDouble(br.readLine()) ; 
       for ( i = 0 ; i <= n ; i++ )
        { 
           s = s+( Math.pow(a,i)/i) ; 
       }
        System.out.println("The sum of the given series = " + s) ;
    }}
0