Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
enter number of rows: 5 asd
enter number of columns:5
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
user will input a number and the inputed rows and columns become a multiplication table.......

What I have tried:

I try to make a 2d array but how can i put the inputed row and columns inside the array and print it?????
Im a begginer on vb.net i only know the basic on vb.net
Posted
Updated 4-Mar-16 1:35am
v3
Comments
Simon_Whale 3-Mar-16 11:00am    
sorry but this smells like a homework question. I'll give you a head start you are going to need loops to complete this task.

We are willing to help you but were not going to paste in a complete answer for you to use. Have a try yourself, post up what you have tried and as much information about the problem and we'll help you further, if you get stuck
Member 12367441 3-Mar-16 11:06am    
but if i loop it i can still do the next step?
user will input multiplier and multiplicand
enter multiplier:4
enter multiplicand: 5
index:(3,4),(4,3)
....
Aria Jafarian 3-Mar-16 11:43am    
You have two numbers fetched from user.
You need two for loops inside each other(nested loop) to multiply these numbers and write them to screen and one check for the result not being zero in the inner loop. Good luck.
Patrice T 3-Mar-16 12:24pm    
That is HomeWork, at least show what you have done, even if not complete.
Aria Jafarian 3-Mar-16 13:19pm    
Definitely. We are just showing him the way. No code given.

1 solution

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

But...I'll give you some clues.
Look at the data you want to generate:
1  2  3  4  5
2  4  6  8 10
3  6  9 12 15
4  8 12 16 20
5 10 15 20 25
First off, it's 5 rows of 5 columns: so you need two loops: one for the rows, and an inner one for each column.
Secondly, if you look at the actual data, the pattern is pretty obvious:
the cell value is the row times the column!
So the value you put in each cell is rowNumber * columnNumber (assuming numbering starts at 1 for each).
That's pretty much all you need to do!
So give it a try...
 
Share this answer
 
Comments
Member 12367441 3-Mar-16 19:45pm    
Module Module1
Dim table(,) As Integer
Dim input_row As Integer
Dim input_columns As Integer
Dim row() As Integer
Dim columns() As Integer
Sub Main()
inputvalue()
prittable()
Console.ReadLine()
End Sub
Sub inputvalue()
Console.Write("enter row: ")
input_row = Console.ReadLine
Console.Write("Enter columns: ")
input_columns = Console.ReadLine
row = New Integer(input_row - 1) {}
columns = New Integer(input_columns - 1) {}
table = New Integer(input_row - 1, input_columns - 1) {}

End Sub
Sub prittable()
For ctr = 0 To row.GetUpperBound(0)
For ctr1 = 0 To columns.GetUpperBound(0)

Console.Write(table(ctr1, ctr))
Next
Console.WriteLine()
Next
End Sub
End Module
how can i put a value on table i dont know the formula to make it an multiplication table.....and is this right?
Patrice T 4-Mar-16 8:43am    
use Improve question to update your question with the code
OriginalGriff 4-Mar-16 8:53am    
"how can i put a value on table i dont know the formula to make it an multiplication table"

Um...so when I said:
"So the value you put in each cell is rowNumber * columnNumber (assuming numbering starts at 1 for each)."
It wasn't enough of a major clue for you?
Member 12367441 4-Mar-16 9:14am    
i think I got it but is this right?
Module main
Dim table(,) As Integer
Dim input_row As Integer
Dim input_columns As Integer
Dim row() As Integer
Dim sum() As Integer
Dim columns() As Integer
Dim multiplier As Integer
Dim multiplicand As Integer


Sub Main()
inputvalue()
other()
Console.ReadLine()
End Sub
Sub inputvalue()
Console.Write("enter row: ")
input_row = Console.ReadLine
Console.Write("Enter columns: ")
input_columns = Console.ReadLine




End Sub
Sub other()
For x As Integer = 1 To input_columns
For y As Integer = 0 To input_row
If y > 0 And x > 0 Then
Console.Write(x * y & vbTab)
End If
Next
Console.WriteLine()
Next
End Sub
OriginalGriff 4-Mar-16 9:35am    
Well, the names could use a little work! :laugh:
But...does it work? What did it generate when you tried it?

I'm not being funny here, this is part of development: it's called "testing" and "debugging". Yes, I could run it. Yes, that would tell me. But...so can you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900