Jump to content

How could I make this code horizontal from vertical for statement

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
onat12agi@gmail.com

onat12agi@gmail.com

    Newbie

  • Members
  • Pip
  • 8 posts
10
9
8
7
6
5
4
3
2
1
Vertical Code:
#include <iostream.h>
int main()
for(i = 10; i > 2; i--)
{
printf("%d ", i);
}

Edited by onat12agi@gmail.com, 09 October 2008 - 04:18 PM.
code check


#2
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts
Ok i did this in dev c++

#include <iostream>

using namespace std;

int main()

{
int i;
for(i = 10; i > 2; i--)
cout << i;
system("PAUSE");
return 0;
}
Posted Image

#3
redkid

redkid

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
This IS horizontal!!

But if you want to make it vertical:

#include <iostream.h>

using namespace std;

int main()
{
	int i;
	
	for(i = 10; i > 2; i--)
	{
	printf("%d\n", i); [COLOR="DarkGreen"]// Just changed this![/COLOR]
	}

	return 0;
}