Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class q2
- {
- public static void main(String[] args)
- {
- int product = 1;
- for (int i = 1; i < 16; i++)
- {
- int mod = i % 2;
- if (mod == 1)
- {
- System.out.println("Integer " + i + " is odd");
- product = product * i;
- }
- }
- System.out.println("\nProduct of odd integers is: " + product);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement