TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rahul jaiswal
NA
177
133k
write a program add two matrix with input user?
Aug 24 2012 2:12 AM
using System;
using System.Collections.Generic;
using System.Text;
namespace AddMatrixUser
{
class Program
{
static void Main(string[] args)
{
int[,] a = new int[2, 2];
//int number = 0;
int[,] b = new int[2, 2];
Console.WriteLine("Enter ther Element");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
a[i,j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine("Enter the second Matrix");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
b[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine("\t"+"First Matrix");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
Console.Write("\t"+a[i,j]);
}
Console.WriteLine("");
}
Console.WriteLine("\t"+"Second Matrix");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
Console.Write("\t"+b[i, j]);
}
Console.WriteLine(" ");
}
Console.WriteLine("\t"+"Add Matrix");
for (int k = 0; k < 2; k++)
{
for (int l = 0; l < 2; l++)
{
Console.Write("\t"+(a[k,l]+b[k,l]));
}
Console.WriteLine(" ");
}
Console.WriteLine("\t" + "Its user input add two matrix " + "\n" + "rahul kumar jaiswal");
Console.ReadLine();
}
}
}
Reply
Answers (
1
)
add two matrix
ForeignKeyConstrain Not Working