Categories: Java

Write a program to print following 1 3 6 10 15 21 28 sequence using for loop in java

Hello Friends Today I will Show You How We Can Print 1 3 6 10 15 21 28 sequence using for loop in java

First Create a Class And A function in your Ide or In Your Code editor

For Example

public class Print {
  public static void main(String[] args) {
    System.out.println("Program Completed");
  }
}

In Next Step You Have To write A Login In for loop i am going to you



public class Print {
  public static void main(String[] args) {
   int sizeofseries=10;
for(int i=2,j=1; i<sizeofseries; i++) 
{ 
  System.out.println(j); 
  j+=i; 
} 
 System.out.println("Program Completed");
  }
}

if you want to take sizeofseries from user yo can follow How To Take input in java.

In This Post I have show you how you can print the following series

admin

View Comments

  • Currently it is appropriate time to produce a few plans for the long run and its time to be happy. Ive learn this post and if I may just I want to suggest you some attention-grabbing issues or advice. Perhaps you can post subsequent articles relating to this blogpost. I wish to learn more things related to it!

Recent Posts

How to make money as a Beginner Coder in 2025

Making money as a coder in 2025 is not much of a big or tough…

10 months ago

Lloyds Technology Centre : A Concise Guide

Lloyds Technology Centre, A tech and data company located in Hyderabad, India. They are  part of…

10 months ago

How to Increase Height at Any Age

How to Increase Height at Any Age Rise Above: How to Increase Height at Any…

12 months ago

The Hidden Beauty of Karrukha Wood: A Rare Masterpiece from Nature

In the fast-paced digital world, we often forget the timeless beauty that nature offers. Today,…

12 months ago

Top 10 Deadliest Kicks in Martial Arts [2024]

Top 10 Deadliest Kicks in Martial Arts: Master the Art of Knockouts Martial arts is…

12 months ago

How to Optimize Battery Life of Your Smartphone

How to Optimize Battery Life of Your Smartphone: Tips and Tricks for Prolonging Battery Health…

1 year ago