SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loop Question please explain this way how to calculate do // comment

    Code javascript:
    <script>
    			x=2;
    			for(i=1; i<10; i++)
    			{
    				if (i>5)
    				break;
    				j=i+1;
    				while(j<10)
    				{
    					x=x+i;
    					j+=1;
    				}
    			}
    			document.write(x)
    		</script>

    Code javascript:
    <script>
    			x=2;//x=2,x=4,X=7,X=11,
    			for(i=1; i<10; i++)//I=1(t),I=1(t),I=1(T),I=4(T),I=5(T)
    			{
    				if (i>5)//f,f,T,T
    				break;
    				j=i+1;//J=3,J=4,_J=5,J=6,
    				while(j<10)//t,t,T,F
    				{
    					x=x+i;//x=4,x=7,X=11,
    					j+=1;//J=4,J=5,J=6
    				}
    			}
    			document.write(x)
    		</script>



    please explain this coding answer is 82....
    Last edited by Mittineague; Sep 14, 2013 at 10:20.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •