Rock Paper and Scissor (Java)
Rock Paper and Scissor (Java)
#include<iostream>
using namespace std;
int main()
{
int a[9][9], b[9][9];
cout<<"Enter the elements of matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>a[i][j];
}
cout<<"Enter the elements of another matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>b[i][j];
}
cout<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cout<<a[i][j]<<ends;
}
cout<<ends<<ends<<ends;
for(int j = 0;j < 3;j++)
{
cout<<b[i][j]<<ends;
}
cout<<endl;
}
cout<<endl<<endl;
}
cout<<endl;
}
return 0;
}
-----------------------------------------------------------------------------
program to subtract 2 matrix:
#include<iostream>
using namespace std;
int main()
{
int a[9][9], b[9][9];
cout<<"Enter the elements of matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>a[i][j];
}
cout<<"Enter the elements of another matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>b[i][j];
}
cout<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cout<<a[i][j]<<ends;
}
cout<<ends<<ends<<ends;
for(int j = 0;j < 3;j++)
{
cout<<b[i][j]<<ends;
}
cout<<endl;
}
cout<<endl<<endl;
}
cout<<endl;
}
return 0;
}
-----------------------------------------------------------------------------------
------------------------
program:3 To multiply two matrix:
#include<iostream>
using namespace std;
int main()
{
int a[9][9], b[9][9];
cout<<"Enter the elements of matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>a[i][j];
}
cout<<"Enter the elements of another matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>b[i][j];
}
cout<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cout<<a[i][j]<<ends;
}
cout<<ends<<ends<<ends;
for(int j = 0;j < 3;j++)
{
cout<<b[i][j]<<ends;
}
cout<<endl;
}
cout<<endl<<endl;
}
cout<<endl;
}
return 0;
}
-----------------------------------------------------------------------------------
----
program4: to divide 2 matrix:
#include<iostream>
using namespace std;
int main()
{
int a[9][9], b[9][9];
cout<<"Enter the elements of matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>a[i][j];
}
cout<<"Enter the elements of another matrix: "<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cin>>b[i][j];
}
cout<<endl;
for(int i = 0;i < 3;i++)
{
for(int j = 0;j < 3;j++)
{
cout<<a[i][j]<<ends;
}
cout<<ends<<ends<<ends;
for(int j = 0;j < 3;j++)
{
cout<<b[i][j]<<ends;
}
cout<<endl;
}
cout<<endl<<endl;
}
cout<<endl;
}
return 0;
}
-----------------------------------------------------------------------------------
program5 : to transpose a matrixx\:
#include<iostream>
using namespace std;
int main()
{
int a[9][9], b[9][9],i,j;
cout<<"Enter the elements of matrix: "<<endl;
for( i = 0;i < 3;i++)
{
for( j = 0;j < 3;j++)
{
cin>>a[i][j];
}
}
for( i = 0;i < 3;i++)
{
for( j = 0;j < 3;j++)
{
cout<<a[j][i]<<ends;
}
cout<<endl;
}
return 0;
}
-----------------------------------------------------------------------------------
-----------------
import java.util.Scanner;
import java.util.Random;
class hello{
if (x == 2 && n == 1) {
System.out.println("congo you win");
}
else if (x == 2 && n ==2) {
System.out.println("Its a tie");
}
else if (x ==2 && n == 3) {
System.out.println("sys win");
}
if (x == 3 && n == 1) {
System.out.println("sys win");
}
else if (x ==3 && n ==2) {
System.out.println("congo you win");
}
else if (x == 3 && n == 3) {
System.out.println("it is tie");
}
}while(n != 4);
}
}