Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1.  
  2. public class q2
  3. {
  4. public static void main(String[] args)
  5. {
  6. int product = 1;
  7.  
  8. for (int i = 1; i < 16; i++)
  9. {
  10. int mod = i % 2;
  11. if (mod == 1)
  12. {
  13. System.out.println("Integer " + i + " is odd");
  14. product = product * i;
  15. }
  16. }
  17.  
  18. System.out.println("\nProduct of odd integers is: " + product);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement