MUST BE WRITTEN IN C
PLEASE KEEP IT SIMPLE. I AM NEW ATPROGRAMMING.
1. Write a loop that reads positive integers fromstandard input and that terminates when it reads an integer that isnot positive. After the loop terminates, it prints out the sum ofall the even integers read and the sum of all the odd integersread. Declare any variables that are needed
WHAT I HAVE
int number=0, sum_even=0, sum_odd=0;
while (number>=0)
{
printf(“enter a positive number (negative number to terminate):”);
scanf(“%d”,&number);
if(number<=0)
break;
else
if(number%2 == 0)
sun_even+=number;
else
sum_odd+=number;
}
printf(“n sum of all even numbers : %d”,sum_even);
printf(“n sum of all odd numbers : %d”,sum_odd);
2. Given an int variable n that has alreadybeen declared, write some code
PayPal Gateway not configured
PayPal Gateway not configured