Course Solutions Uncategorized (Solved) : Must Written C Please Keep Simple New Programming 1 Write Loop Reads Positive Integers Sta Q26701816 . . . .

(Solved) : Must Written C Please Keep Simple New Programming 1 Write Loop Reads Positive Integers Sta Q26701816 . . . .

 

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

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : 1 Point Give Vector Parametric Equation Line Point 1 1 Perpendicular Line 2 5t 1 21 L T Q33346132 . . . .(Solved) : 1 Point Give Vector Parametric Equation Line Point 1 1 Perpendicular Line 2 5t 1 21 L T Q33346132 . . . .

<p><img alt="(1 point) Give a vector parametric equation for the line through the point (1,-1) that is perpendicular to the line (2- 5t,1 21): L(t) =" src="https://media.cheggcdn.com/media%2F33b%2F33b98d41-9fea-4630-81fc-3ef91c9e9e97%2FphpOf9F4E.png" style="height:95px;width:875px;" aria-describedby="d3f"/></p>(1 point)