Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Java help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="SHEN746" data-source="post: 3199449" data-attributes="member: 23358"><p>In the 1st place your for loop structure was wrong so it won't compile. you can use for(i=1 ;i<=10 ; ) but not for(i=1;i<=10) . Unless ur using the enhanced for loop which is there from java 1.5 onwards but that also uses a colon ( : ) not a semi-colon. And y r u proceeding to print i without incrementing it ?!. Which will only print the same value again and again rt ?!.Regarding your case it seems u simply want to have a summtion of squares from 1 to 10 right ?!. which mens (1^2)+(2^2)+(3^2)+....rt ?!(i.e : 1+4+9+16+25+..etc rt?). ^ stand for square root in java. In that case in could be done like the following : </p><p>class s</p><p>{</p><p> </p><p> public static void main(String args[])</p><p> { </p><p> int tot =0;</p><p> int square=0;</p><p> for (int i=1; i<=10; ) </p><p> {</p><p> square=(i*i);</p><p> System.out.println("The Current Square Root Calculated is : "+square);</p><p> i+=1;</p><p> </p><p> tot+= square;</p><p> </p><p> }</p><p> System.out.println("End of Loop Total Value of Summation is : "+tot);</p><p> }</p><p>}</p><p></p><p>If this is not what u want or if ur not clear about anything pls let me know I'll be more than happy to help out <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":-)" title="Smile :-)" loading="lazy" data-shortname=":-)" /> !!.</p></blockquote><p></p>
[QUOTE="SHEN746, post: 3199449, member: 23358"] In the 1st place your for loop structure was wrong so it won't compile. you can use for(i=1 ;i<=10 ; ) but not for(i=1;i<=10) . Unless ur using the enhanced for loop which is there from java 1.5 onwards but that also uses a colon ( : ) not a semi-colon. And y r u proceeding to print i without incrementing it ?!. Which will only print the same value again and again rt ?!.Regarding your case it seems u simply want to have a summtion of squares from 1 to 10 right ?!. which mens (1^2)+(2^2)+(3^2)+....rt ?!(i.e : 1+4+9+16+25+..etc rt?). ^ stand for square root in java. In that case in could be done like the following : class s { public static void main(String args[]) { int tot =0; int square=0; for (int i=1; i<=10; ) { square=(i*i); System.out.println("The Current Square Root Calculated is : "+square); i+=1; tot+= square; } System.out.println("End of Loop Total Value of Summation is : "+tot); } } If this is not what u want or if ur not clear about anything pls let me know I'll be more than happy to help out :-) !!. [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom