How to make 'n' input TRUTH TABLE using java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make 'n' input TRUTH TABLE using java

30th Dec 2016, 11:21 AM
Vaibhav Tandon
Vaibhav Tandon - avatar
6 Answers
+ 2
So you can just create a matrix by using therefore a 2-dimensional array and make it (2^n)x(n+1) large. Then fill up the first n lines with 0s and 1s and iterate with loop row by row by using your function to assign the result values in the last column
30th Dec 2016, 1:37 PM
Andreas K
Andreas K - avatar
+ 1
Do you want to create a program which inputs a number n and create a truth table for the n input signals for a specific function?
30th Dec 2016, 12:09 PM
Andreas K
Andreas K - avatar
+ 1
I would think the easiest way eg n=3 000 001 010 011 100 101 110 111
30th Dec 2016, 1:53 PM
Andreas K
Andreas K - avatar
0
yes
30th Dec 2016, 12:46 PM
Vaibhav Tandon
Vaibhav Tandon - avatar
0
0's and 1's should be filled in which order??
30th Dec 2016, 1:44 PM
Vaibhav Tandon
Vaibhav Tandon - avatar
0
thanks
30th Dec 2016, 1:54 PM
Vaibhav Tandon
Vaibhav Tandon - avatar