PLEASE WRITE THE OUTPUT FOR THE FOLLOWING 1 Output for p2 p
PLEASE WRITE THE OUTPUT FOR THE FOLLOWING
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;
total++;
}
Solution
Question 1:
Answer:
p is now: 2 p is now: 4 p is now: 6 p is now: 8 p is now: 10
Question 2:
Answer:
1
3
5
7
9
Question 3:
Answer:
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello

