|
|
|
series
|
Article:
|
Viewed:
1816
Posted On:
23/07/2013 22:29:11
Hi all,With the help of this article i am going to tell you that how we can print the series 1,4,9,16,25,..............up to 15 terms
|
|
|
Below is my code:
class series { public static void
main(String s[]) { int a,b; for(a=1;a<=15;a++) { b=a*a; System.out.print(","+b); } } }
Step 1: After writing this in notepad save the file with the name
followed by (.java) for eg. I saved it with series.java
Step 2 : Open
command prompt
Step 3 : Write javac series.java
- Press Enter for compilation
Step 4 : Write java series for
execution
Now output:

Image 1.
|
|
|
|
|
|