What is the program to print
2,5,10,17
In java
Answers
Answered by
76
import java.util.*;
class series
{
public static void main ()
{
into i, s;
for (i =1;i <=4;i++);
{
s=i*i +1;
System.out.print(s);
}
}
}
class series
{
public static void main ()
{
into i, s;
for (i =1;i <=4;i++);
{
s=i*i +1;
System.out.print(s);
}
}
}
Answered by
35
The program to print
2,5,10,17....
Output
=>2,5,10,17
=>1×1=1=2
=>2×2+1=5
=>3×3+1=10
=>4×4+1=17
class prog
{
void display()
{
int sum =1 ;
for (int i =1;i<=4;i++)
{
sum=i*i+1
System.out.print(sum+",");
}
}
}
Similar questions