package com.codegym.task.task04.task0437;
/*
Triangle of eights
*/
public class Solution {
public static int n = 1;
public static void main(String[] args) throws Exception {
//write your code here
for(int i = 0;i<10;i++){
rect();
n++;
}
}
public static void rect(){
for(int i = 1;i<=n;i++){
if(n>10){
break;
}
System.out.print("8");
Solution.n=n;
}
System.out.print("\n");
}
}
i made a triangle of base 10 and height 10 but getting error! I have also proved it by run(without verification!
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Faizu Flc
5 May 2020, 04:28
*
Triangle of eights Simple code
*/
public class Solution {
public static void main(String[] args) throws Exception {
for(int i = 1;i <= 10;i++) {
for(int j = 1;j <= i;j++) {
System.out.print("8");
}
System.out.println();
}
}
}
+2
Show How
31 May 2019, 15:33
Your code looks ok to me but just give it a try by changing the string "8" to int 8 and see if it passes.
+2