Question: 2 h02 CS16 W19 6. (4 pts) Write an if-else statement that outputs the string Grade is B if the variable `score` is between 80

2
h02
CS16 W19
  1. 6. (4 pts) Write an if-else statement that outputs the string "Grade is B" if the variable `score` is between 80 and 90 (both limits included). Otherwise the if-else statement should output "Grade is not B" ?7. (4 pts) The program below intends to do the following: Repeatedly prompt the user to input an integer number. When the user no longer wants to continue entering numbers, output the sum of all the positive numbers entered by the user followed by the sum of all the negative numbers entered by the user. However, the given program has errors. Mark all logical and syntax errors in the program and provide corrections in the space provided to the right. Add missing statements if any.
    #include  int main(){ int a , sumPositive, sumNegative; string promptContinue =" To continue enter Y/y "; string promptNum = " Enter a number: "; char response; while (response = 'y'||`Y') { cout << promptNum; cin >> a; if(a) sumPositive+=a; else sumNegative+=a; cout<< promptContinue; } cout<< "Sum of all the positive numbers is: "<< sumPositive< 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!