how do i display something like this using for loop?

0
2 4 6 8 10 12 14
18 24 26 28 30 32

thank you for helping...

Recommended Answers

All 3 Replies

s

s

Please don't spam...as well, I assume that you wanted the last pattern to start with 22, not 18, correct? If so, here is the code. This does not sound like a graded assignment to me, because of the simplicity...so here is the original source code:

#include<iostream>
using namespace std;
int main()
{
	for(int x=0;x<=0;x++)
		cout << x << " ";
	cout << endl;
	for(int x=2;x<14;x+=2)
		cout << x << " ";
	cout << endl;
	for(int x=22;x<32;x+=2)
		cout << x << " ";
	cout << endl;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.