Tuesday, January 30, 2024

Java Program Triangular Number Series

 The first 10 terms of the Triangular number series:

1 3 6 10 15 21 28 36 45 55 


class Triangular

{ 

    void main()

    {      

         int i,n=1;          

         System.out.println("Series as follows ");  

       for(i=0;i<10;i++)

       {

           n=n+i;

           System.out.print(" "+n);

           n++;

        }     

    }

}  

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner