Draw Triangles
From Hack Wars Wiki
Outdated, should be deleted. - aoi
| Challenge Information for Draw Triangle | |
| Challenge | Draw Triangle |
| Code | 7 |
| Input Example | 6,3 (Int) |
| Output Example | **, ****, ****** (String) |
| Level | 0 |
| Profit | $0 |
| Experience | 0 to each stat |
| Description | Draw a triangle given the base and height. |
Solution
int base = getInputInt(); int height = getInputInt(); int invSlope = base / height; string stars = "*********************************************"; string output = ""; int i = 0; while(i < height) { i++; setOutputString(substr(stars, 0, i * invSlope)); } |
