Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Part I – Write individual for( ) statements for the following cases: 1. Use a counter named p that has an initial value of 3, a final value of 18, and an increment of 1. 2. Use a counter named count...

1 answer below »
Part I – Write individual for( ) statements for the following cases:
1. Use a counter named p that has an initial value of 3, a final value of 18, and an increment of 1.
2. Use a counter named count that has an initial value of 1, a final value of 20, and an increment of 5.
3. Use a counter named j that has an initial value of 30, a final value of 10, and a decrement of 5.
4. Use a counter named price that has an initial value of 5, a final value of 15, and an increment of .5.
5. Use a counter named jcount that has an initial value of 20, a final value of 1, and a decrement of 2.
PART II - What will be the output of the following segment of the program?
1.
                                    Output
    for( p=2; p<=10; p += 2)
cout
“p is now: ”
p
endl;
2.
    int total =50;                                 Output
    for ( i = 1; i <= 10; i += 2)
    cout
i
endl;
3.
    int total =0;                                 Output
    while(total<10) {
    cout
” Hello”
endl;
XXXXXXXXXXtotal++;
}
4. Write a Program that used a repetition structure to display all even numbers between 0 and 200.
Answered Same Day Mar 11, 2021

Solution

Mohd answered on Mar 12 2021
154 Votes
Part I – Write individual for( ) statements for the following cases:
1. Use a counter named p that has an initial value of 3, a final value of 18, and an increment of 1.
int p = 3;
for(p; p<18; p++);
cout
“p: ”
p;
2. Use a counter named count that has an initial value of 1, a final value of 20, and an increment of 5.
int count = 1;
for(count; count<20; count = count+5)
if(count == 1)
        count=0;    
cout
“count: ”
count;
3. Use a counter named j that has an initial value of 30, a final value of 10, and a decrement of 5.
int j =30;
    for(j; j>10; j = j-5);
cout
“j: ”
j;
4. Use a counter named price that has an initial value of 5, a final value of 15, and an increment of .5.
double price =5;
    for(price; price<15;...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here