Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int i, num1, num2, sum = 0, product = 1;
- printf("Enter the first number: ");
- scanf("%d", &num1);
- printf("Enter the second number: ");
- scanf("%d", &num2);
- for(i < num1 + 1; i <= num2; i++){
- if(i % 2 == 0){
- sum = sum + i;
- }
- if(i % 2 != 0){
- product = product * i;
- }
- }
- printf("\n");
- printf("Sum of even numbers: %d\n", sum);
- printf("Product of odd numbers: %d", product);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement