Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int j = 10;
- int k = 0;
- while (j > 0)
- {
- if (k <= j)
- {
- Console.Write("* ");
- Console.WriteLine();
- }
- j--;
- } Console.WriteLine();
- for (initializer; condition; iterator) {
- body;
- }
- initializer;
- while (condition) {
- body;
- iterator;
- }
- // Height and width of the triangle
- var h = 8;
- var w = 30;
- // The iterator variables
- var y = 1;
- var x = 1;
- // Print the tip of the triangle
- Console.WriteLine("*");
- y = 1;
- while (y++ <h) {
- // Print the bit of left wall
- Console.Write("*");
- // Calculate length at this y-coordinate
- var l = (int) w*y/h;
- // Print the hypothenus bit
- x = 1;
- while (x++ <l-3) {
- Console.Write(" ");
- }
- Console.WriteLine("*");
- }
- // Now print the bottom edge
- x = 0;
- while (x++ <w) {
- Console.Write("*");
- }
- *
- * *
- * *
- * *
- * *
- * *
- * *
- * *
- ******************************
- int x = 1;
- int j = 10;
- int k = 0;
- while (j > 0)
- {
- if (k <= j)
- {
- Console.Write("* ");
- }
- if (j >= 1)
- {
- int temp = x;
- while (temp >= 0)
- {
- Console.Write(" ");
- temp--;
- }
- x = x + 1;
- Console.Write("*");
- }
- Console.WriteLine();
- j--;
- }
- Console.WriteLine();
- double f = Math.Round(x * 1.5);
- while (f != 0)
- {
- Console.Write("*");
- f--;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement