write a program to sum of even number and product of odd numbers present in a list
Answers
Answered by
15
#include <stdio.h>
void main()
{
int i, num, odd_sum = 0, even_sum = 0;
printf("Enter the value of num\n");
scanf("%d", &num);
for (i = 1; i <= num; i++)
{
if (i % 2 == 0)
even_sum = even_sum + i;
else
odd_sum = odd_sum + i;
}
printf("Sum of all odd numbers = %d\n", odd_sum);
printf("Sum of all even numbers = %d\n", even_sum);
}
❥︎hope IT helps
Answered by
1
this is your answer I hope it will help you please mark as brainliest thanks and follow me guys
Attachments:
Similar questions
Math,
3 months ago
Math,
3 months ago
Physics,
3 months ago
Computer Science,
7 months ago
Science,
7 months ago
History,
11 months ago
Computer Science,
11 months ago