Syvum Home Page

Home > Discussions > For all activities

Discussion topic: Contributed Answer/Explanation to Q. 13

Viewing replies        View entire discussion

To go to the homepage of this topic, click here.
Home: hayabusaOriginal MessageReply  
Subject: Contributed Answer/Explanation to Q. 22
   class sum

Posted at: Mon Jan 31 12:00:26 2011 (GMT)

Page 1 of 1
From: hayabusaReply 1 of 1Reply
Subject: Contributed Answer/Explanation to Q. 22
   program
   class sum{public static void main(int n){even=0,odd=0;for(int
   i=1;i<=n;i++){if(i%2==0)even=even+i;elseodd=odd+i; } System.out.println
   ("sum of even="+even) ;System.out.println("sum of
   odd="+odd); } } 

Posted at: Mon Jan 31 12:10:36 2011 (GMT)

Page 1 of 1

To post to this forum, you must be signed in as a Syvum member. Please sign in / register as a member.

Contact Info © 1999-2024 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright