for loops statement

[b][b]i have a homework about this, i need to print out:
(a's are not included it is use for spacing)

1.
*****
****
***
**
*

2.
aaaa*
aaa* *
aa* * *
a* * * *

3.
aaaaaaa1
aaaaaa121
aaaaa12321
aaaa1236321


PLEASE HELP M[/b]E. [/b]
Last edited on
This forum is not a homework service. You need to try it yourself, show your attempt, and then somebody will help you work through it.
closed account (10oTURfi)
Wow. Now that is rather easy homework...
Is it this?
1
2
3
4
5
6
7
8
9
#include <stdio.h>


int main(void)
{
   printf("1.\n*****\n****\n***\n**\n*\n\n2.\naaaa*\naaa* *\naa* * *\na* * * *\n\n3.\naaaaaaa1\naaaaaa121\naaaaa12321\naaaa1236321\n");

   return 0;
}
Last edited on
closed account (10oTURfi)
OK you asked program to do that. I made you one. This will indeed compile and work as you want it to do, but your teacher will kill you if you use it as homework. XD

EDIT: I think what Syuf wrote will work better than mine.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

int a = 0; //Global variables FTW
int i;

int main(void)
{
	for(i=0; i<16; i++){
		cout << "*";
		a++;
		if(a==5 || a==9 || a==12 || a==14 || a==15) //ROFL
			cout << endl;
	}
}
Last edited on
Topic archived. No new replies allowed.