COMP 1150-01 Fall 2017 Assignment 4 To receive full credit, the assignment must
ID: 3601081 • Letter: C
Question
COMP 1150-01 Fall 2017 Assignment 4 To receive full credit, the assignment must be submitted by the due date. Late subemissions will incur a Student Name: Total 40 points Due date: 10/31/17 penalty of 5% per day. 1. (4 points) Given the following algorithm: if (raining): watch TV if (temperature is hot): else: else: go swimming play golt a) b) What is the action if it is raining and not hot? What is the action if it is not raining and not hot? 2. (8 points) Given the following algorithm: 2 Count x-0 while (CountExplanation / Answer
1.
a) Watch TV is the action if it is raining and not hot.
b) play golf is the action if it is not raining and not hot.
2.
2 3 4 5 6 20
7)
int main()
{
//Step1: Initialize the sum=0.
int sum=0;
//Step2. Run the for loop between 2 and 2000
for(int i = 2; i < 2000; i++)
{
//step3: If the Number is even (i%2==0)
if(i%2==0)
{
//Step4: Print the even Number and add it to sum
printf("%d ",i);
sum=sum+i;
}
}
//Step5: exit the program
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.