write a program in Java to display the first 10 terms of the series :
1 , 2 , 4 , 7 , 11 , .............
Answers
Answered by
62
class series
{
public static void main()
{
int a=1,b=1;
for(int i=1;i<=10;i++,b++)
{
System.out.println(a+", ");
a+=b;
}
}
}
{
public static void main()
{
int a=1,b=1;
for(int i=1;i<=10;i++,b++)
{
System.out.println(a+", ");
a+=b;
}
}
}
Answered by
13
Answer:
public class Series
{
public static void main(String args[])
{
for (int i = 0; i < 10; i++)
{
int term = 1 + ((i * (i + 1)) / 2);
System.out.print(term + " ");
}
}
}
Similar questions