/*
Lab 3 Teaching Example

Let's say you wanted to write a program that printed out a triangle, given a number
that specifies both its height and its base height. So for example, a '3' triangle would be:

*
**
***

and a 4 triangle would be:

*
**
***
****

Algorithm
1. Ask the user for how big the triangle should be.
2. Store how big the triangle should be.
3. For every row from 0 to the triangle height:
    4. For every column from 1 to the current row number:
            5. Print a star.

*/

#include <stdio.h>

int main(void){
	//declare a variable to hold the triangle width/height
	int triangleSize;

	//ask the user to type in the size
	fprintf(stdout,"Please type in the size you'd like for the triangle: ");
	
	//get the size from the keyboard
	fscanf(stdin,"%d",&triangleSize);

	//declare a variable to keep track of the row we're on
	int row = 1;
	
	//for each row counting up to the last row
	while (row <=triangleSize){
		//print out the columns
		//declare a variable to hold the number of columns, and start in the first column
		int column = 1;
		
		//we want to print out as many columns as the current row we're on
		while (column <= row){

			//print a star for that column
			printf("*");

			//go to the next column
			column = column + 1;
		}


		//go to the next row
		//move to the next line
		printf("\n");

		//advance the row counter
		row = row + 1;
	}


	return 0;
}
