+ 2
If i want to display my ans as like this
1*1=1 2*1=2 3*1=3 1*2=2 2*2=4 3*2=6......upto the user wants https://code.sololearn.com/ct76s3dO5KiB/?ref=app Arun Tomar Gaurav Agrawal Fata1 Err0r Helga Hans Larry HAWKEYE Dev
20 Answers
+ 3
+ 7
https://code.sololearn.com/cFJxHtc7Kz4L/?ref=app
take an idea
change according to your need
+ 7
Harsh Agrawal
System.out.print(num+"* "+i+" ="+ result);
System.out.print(" ");
use this instead of you used..
okkk
+ 3
public class Program
{
public static void main(String[] args) {
int num = 1;
while (num <= 10) {
int i = 1;
while (i <= 10) {
int result = num * i;
System.out.print(num + " * " + i + " = " + result + " ");
if( i == 10) {
System.out.println();
}
i++;
}
System.out.println();
num++;
}
}
}
Try this
+ 2
so you want them to be displayed on one line? just use system.out.print instead of println
+ 1
Arun Tomar but i want to in horizontal that i given in my question so plzzz tell me how will i solve with if i want to display my ans in horizontal i.e.in my program the table is displayed down by down by i want to be in single side
e.g.
1*1=1 2*1=2 3*1=3......or upto the user want
+ 1
Arun Tomar no it is not working if u can den plzzz rewrite my code n send it to me!!!
+ 1
try to describe what you want as precisely as possible. its a crucial skill in programming, to be able to explain what result you want (also, sometimes while doing so you come to a better understanding of how it should be done)
+ 1
Helga and Arun Tomar n Phoenix28
i want to display my ans like this
1*1=1 2*1=2 3*1=3
1*2=2 2*2=4 3*2=6
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12
1*5=5 2*5=10 3*5=15
+ 1
Helga thnk u so much but can u do one more favours for me that can u make dis same program with while loop????
nd one more thing i want to ask u can u give some tricks to solve pattern dat if anyone given some pattern how wll u take d pattern to display???
+ 1
okay, i'll re-write the code when i have a few minutes of free time.
could you explain what exactly you need to do with the pattern display?
+ 1
Helga i mean dat if someone given me some pattern den how wll i solve dat problem????
i.e. what is the step to solve pattern question???
+ 1
i find it very helpful to write a solutiin on a piece of paper, to figure out what the solution must look like. while writing the code, insert your variable names into the output to have a beyter understanding of what is going on
+ 1
https://code.sololearn.com/cs17k053aPuO/?ref=app for example. it outputs not just the result i need but also the variable names, so i have better understanding if what my code is doing
+ 1
Helga thnxxxxz
now u can check my code i do according to ur code but it only print 2 table in one side so der is any problem with mobile space or something else??
+ 1
it happens because of the condition in the second while loop
+ 1
@helga ya dat i know but if i use der i<=4 den it wll print on next line i.e.the bigger d phone size the more table be add
0
Helga no it is not working according to what i want!!!!
if u can den plzzz givee the code ???
0
no Arun Tomar u r not solving my problem as i want.....try to do what my question is saying
0
it's an inefficient silution, but i'd just copy these two while loops (the way i made it with for() in my code) changing the variables' values