Question: 1. Given int a = 3; int b = 11; Is the following expression true or false? a == 3 2. Write the output: int

1. Given int a = 3; int b = 11;

Is the following expression true or false? a == 3

2. Write the output:

int i, j; for (i = 1; i <=2; i++) { for( j = 0; j < 2; j++) cout << "slow,"; for( j = 0; j < 2; j++) cout << "quick,"; cout << endl; }

3. Rewrite the following for loop as a while loop. The while loop must output what the for statement does and no more. Assume int i; int num;

for (i = 1; i <= num; i++) { if(num % i == 0) cout << i << endl; }

4. Using the Metabolic Equivalent of Task value for a given activity, the number of calories burned per hour can be calculated. The formula is a persons weight in pounds divided by 2.2 and multiplied by the MET value for the given activity. Write a program to input the MET value and out put the number of calories burned per hour for a person for each pound between 120 and 190 inclusive. The sample output is for the cycling MET which is 8.0.

Write main() and no other functions. Output formatted as shown (actual width of columns not important as long as the decimal points are lined up and there is one point to right of decimal point for real numbers.

Enter MET for activity: 8.0 Weight Calories burned 120 436.4 121 440.0 122 443.6 123 447.3 124 450.9 125 454.5 126 458.2 127 461.8 . . . 186 676.4 187 680.0 188 683.6 189 687.3 190 690.9 Press any key to continue 

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!