CodeGym
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Question
  • Reviews
  • About us
Start
Start learning
Start learning now
  • All questions
CodeGym/Help with Java Tasks/What wrong with this code
hasith
Level 4
Colombo
  • 07.06.2019
  • 1880views
  • 5comments

What wrong with this code

Question about the task Multiplication table
Java Syntax,  Level 3,  Lesson 6
Resolved

Display a 10 x 10 multiplication table in the following form:
1 2 3 4 …
2 4 6 8 …
3 6 9 12 …
4 8 12 16 …
…

Requirements:
  • The program should output text.
  • The displayed text should contain 10 lines.
  • Each displayed string must contain 10 numbers separated by spaces.
  • The displayed numbers must form a multiplication table.
package com.codegym.task.task03.task0314; /* Multiplication table */ public class Solution { public static void main(String[] args) { //write your code here String a = " 1 2 3 4 5 6 7 8 9 10" ; String b = " 2 4 6 8 10 12 14 16 18 20" ; String c = " 3 6 9 12 15 18 21 24 27 30"; String d = " 4 8 12 16 20 24 28 22 26 40"; String e = " 5 10 15 20 25 30 35 40 45 50"; String f = " 6 12 18 24 30 36 42 48 54 60"; String g = " 7 14 21 28 35 42 49 56 63 70"; String h = " 8 16 24 32 40 48 56 64 72 80"; String i = " 9 18 27 36 45 54 63 72 81 90"; String j = "10 20 30 40 50 60 70 80 90 100"; System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(f); System.out.println(g); System.out.println(h); System.out.println(i); System.out.println(j); } }
0
Comments (5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Prabin Kunwar
Level 4 , Saint Louis, United States
16 October 2019, 18:03
Please read the Conditions carefully before you code. In line 21, add space in front of 10 ..(" 10 20 30 . . .. ) Any way i did it using for loop. for (int x = 1; x <= 10; x++){ for (int y =1; y <= 10; y++){ System.out.print(x*y + " "); } System.out.println(); }
+1
Thomas Sixberry
Level 16 , Rochester Hills, United States
20 January 2020, 21:31
We haven't gone over this yet, left to guess (or come back to) and the Conditions are not clear at all. At least for me, the novice.
0
TUSHAR SHUKLA
Level 3 , Roorkee, India
9 June 2019, 09:33
bddy i realised the amount of hardwork you did,but the way you solved it is so time consuming and can work for small outputs.
0
Dharun Karthi
Level 6 , Chennai, India
7 June 2019, 15:47
in line 21, add space in front of 10
+1
Jason
Level 26 , Rancho Cucamonga, United States
9 June 2019, 01:48
yeah, that might work as well. I was thinking you had to take all the spaces out of the front for each line but I'm not 100% sure how picky the parameters are.
0
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2025 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2025 CodeGym