Question: I am working on a C# program and I can't get the results to display in a Message Box, it keeps showing the MessageBox.Show as

I am working on a C# program and I can't get the results to display in a Message Box, it keeps showing the MessageBox.Show as not a valid entry, what am I missing to get this to display in a MessageBox.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace Exercise_3 { class Program { static void Main(string[] args) { int i, num; double[] a = new double[] { 1.8, 4.6 }; double[] b = new double[] { 8.3, 2.2 }; double[] c = new double[] { 1 }; double sum = 0; string res = "First matrix is: ", res1 = " Second matris is: ", res2 = "matrix multiplication is: "; Console.WriteLine("Press 1 for multiplication" + "...");

num = Convert.ToInt32(Console.ReadLine());

for (i = 0; i < 2; i++) { res += a[i] + "\t"; } for (i = 0; i < 2; i++) { res1 += b[i] + " "; } if (num == 1) { for (i = 0; i < 2; i++) { sum += a[i] * b[i]; } for (i = 0; i < c.Length; i++) { c[i] = sum; res2 += c[i]; } MessageBox.Show(res + res1 + res2); } else { MessageBox.Show("Wrong input..."); } Console.ReadKey(); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!