Please help me to solve the error in the following program. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help me to solve the error in the following program.

import java.io.*; public class Program { public static void main(String[] args) { DataInputStream in=new DataInputStream (Syste.in); System.out.println("Enter a num"); int n=Integer.parseInt(in.reqdLine()); int i,j,k; for(i=0;i<n;i++) { k=0; for(j=1;j<(2n);j++) { if(j==n-k || j==n+k) System.out.print("*"); else System.out.print(" "); k++; } System.out.println(); } } }

27th Apr 2020, 8:06 AM
Deven
Deven - avatar
7 Answers
0
Hope I could help
27th Apr 2020, 8:44 AM
Alexander Thiem
Alexander Thiem - avatar
+ 1
There stands Syste.in
27th Apr 2020, 8:15 AM
Alexander Thiem
Alexander Thiem - avatar
0
Thank u for that But it continues to show the same problem 😅
27th Apr 2020, 8:26 AM
Deven
Deven - avatar
0
This is an version of your code without spelling mistakes. As it looks like SoloLearn does nit Support DataInputStream SoliLearn does not even ask tye user for input... https://code.sololearn.com/coRtwe9l6S4U/?ref=app Mybe you look at how SoloLearn wants you to search for user Input: https://www.sololearn.com/learn/Java/2220/ Tyen your Programm would look like this: https://code.sololearn.com/cJ7sN69806ho/?ref=app
27th Apr 2020, 8:34 AM
Alexander Thiem
Alexander Thiem - avatar
0
Type errors.. readLine() ; // not reqdline() 2*n, //not 2n And as said already System.in..
27th Apr 2020, 8:34 AM
Jayakrishna 🇮🇳
0
Thank u very much I got the two problem (and some spelling errors 😝) 1. The Input part 2. The 2*n one Thanks once again 🙏
27th Apr 2020, 10:02 AM
Deven
Deven - avatar
0
Tou are welcome
27th Apr 2020, 10:03 AM
Alexander Thiem
Alexander Thiem - avatar