Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 11 May/problem01/problem01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<iostream>

using namespace std;

int main()
{
int arr[] = {1,1,2,2,3,4,4,5,5};
int len = sizeof(arr)/sizeof(arr[0]);
int i ,result = arr[0];

for(i = 1;i < len; i++)
{
result = result ^ arr[i];
}

cout<<"Print the single number: "<<result<<endl;
}
Binary file added 11 May/problem01/problem01.exe
Binary file not shown.
Binary file added 11 May/problem01/problem01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions 11 May/problem05/problem05.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include<iostream>
using namespace std;

int main()
{
int number;
cout<<"Please enter a digit: ";
cin>>number;

if(number == 0 || number == 1)
{
cout<<"Sqaure root of the given number is :"<<number;
}

int start = 1, end = number, mid, result ;
while(start <= end)
{
mid = (start + end)/2;
if(mid*mid == number)
{
cout<<"Square root is: "<<mid;
}
else if (mid*mid < number)
{
start = mid + 1;
result = mid;
}
else
end = mid - 1;
}
cout<<"Sqaure root is: "<<result;
}
Binary file added 11 May/problem05/problem05.exe
Binary file not shown.
Binary file added 12 May/Problem01/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions 12 May/Problem01/solution01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include<iostream>
#define N 3

using namespace std;

int main ()
{

int count=0,i,j;
int arr[N][N];

//Input matrix elements
cout << "Enter elements "<< N*N <<" of array:" << endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cin>>arr[i][j];
}
cout<<endl;
}


cout<<"Matrix is: "<<endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cout<<arr[i][j]<<" ";
}
cout<<endl;
}


for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
int sum = 0;
bool isPrime = true;

if (i - 1 >= 0)
sum += arr[i - 1][j];

if (i + 1 < N)
sum += arr[i + 1][j];

if (j - 1 >= 0)
sum += arr[i][j - 1];

if (j + 1 < N)
sum += arr[i][j + 1];


for(int k=2;k <= sum/2;k++)
{
if (sum % k == 0)
{
isPrime = false;
break;
}
}
if (isPrime)
count++;

}

}

cout <<"Output: "<< count <<endl;
}
Binary file added 12 May/Problem01/solution01.exe
Binary file not shown.
Binary file added 12 May/Problem02/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions 12 May/Problem02/solution02.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include<iostream>
#define N 3

using namespace std;

int main()
{
int arr[N][N];
int search=0,i,j,flag = 0;;

cout<<"Please enter "<<N*N<<" elements:"<<endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cin>>arr[i][j];
}
cout<<endl;
}

cout<<"Enter the number which you want to search: ";
cin>>search;

for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
if(search == arr[i][j])
flag = 1;
}
}

if(flag == 1)
cout<<"Number Found at ("<<i<<","<<j<<")"<<endl;
else
cout<<"Number not Found"<<endl;


}
Binary file added 12 May/Problem02/solution02.exe
Binary file not shown.
Binary file added 12 May/Problem03/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions 12 May/Problem03/solution03.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include<iostream>
#define N 4

using namespace std;

int main()
{
int arr[N][N];
int search=0, i, j, flag = 0, count = 0;

cout<<"Please enter "<<N*N<<" elements:"<<endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cin>>arr[i][j];
}
cout<<endl;
}

cout<<"Matrix is: "<<endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cout<<arr[i][j]<<" ";
}
cout<<endl;
}

for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
if(arr[j][i] == 1)
{
count++;
}
}
if(count%2 != 0)
{
flag++;
count = 0;
}
}

cout<<"Output: "<<flag;

}
Binary file added 12 May/Problem03/solution03.exe
Binary file not shown.
17 changes: 17 additions & 0 deletions ArchikaVyas/11_May/problem01/problem01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<iostream>

using namespace std;

int main()
{
int arr[] = {1,1,2,2,3,4,4,5,5};
int len = sizeof(arr)/sizeof(arr[0]);
int i ,result = arr[0];

for(i = 1;i < len; i++)
{
result = result ^ arr[i];
}

cout<<"Print the single number: "<<result<<endl;
}
Binary file added ArchikaVyas/11_May/problem01/problem01.exe
Binary file not shown.
Binary file added ArchikaVyas/11_May/problem01/problem01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions ArchikaVyas/11_May/problem05/problem05.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include<iostream>
using namespace std;

int main()
{
int number;
cout<<"Please enter a digit: ";
cin>>number;

if(number == 0 || number == 1)
{
cout<<"Sqaure root of the given number is :"<<number;
}

int start = 1, end = number, mid, result ;
while(start <= end)
{
mid = (start + end)/2;
if(mid*mid == number)
{
cout<<"Square root is: "<<mid;
}
else if (mid*mid < number)
{
start = mid + 1;
result = mid;
}
else
end = mid - 1;
}
cout<<"Sqaure root is: "<<result;
}
Binary file added ArchikaVyas/11_May/problem05/problem05.exe
Binary file not shown.
Binary file added ArchikaVyas/12_May/Problem01/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions ArchikaVyas/12_May/Problem01/solution01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include<iostream>
#define N 3

using namespace std;

int main ()
{

int count=0,i,j;
int arr[N][N];

//Input matrix elements
cout << "Enter elements "<< N*N <<" of array:" << endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cin>>arr[i][j];
}
cout<<endl;
}


cout<<"Matrix is: "<<endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cout<<arr[i][j]<<" ";
}
cout<<endl;
}


for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
int sum = 0;
bool isPrime = true;

if (i - 1 >= 0)
sum += arr[i - 1][j];

if (i + 1 < N)
sum += arr[i + 1][j];

if (j - 1 >= 0)
sum += arr[i][j - 1];

if (j + 1 < N)
sum += arr[i][j + 1];


for(int k=2;k <= sum/2;k++)
{
if (sum % k == 0)
{
isPrime = false;
break;
}
}
if (isPrime)
count++;

}

}

cout <<"Output: "<< count <<endl;
}
Binary file added ArchikaVyas/12_May/Problem01/solution01.exe
Binary file not shown.
Binary file added ArchikaVyas/12_May/Problem02/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions ArchikaVyas/12_May/Problem02/solution02.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include<iostream>
#define N 3

using namespace std;

int main()
{
int arr[N][N];
int search=0,i,j,flag = 0;;

cout<<"Please enter "<<N*N<<" elements:"<<endl;
for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
cin>>arr[i][j];
}
cout<<endl;
}

cout<<"Enter the number which you want to search: ";
cin>>search;

for(i = 0; i < N; i++)
{
for(j = 0;j < N; j++)
{
if(search == arr[i][j])
flag = 1;
}
}

if(flag == 1)
cout<<"Number Found at ("<<i<<","<<j<<")"<<endl;
else
cout<<"Number not Found"<<endl;


}
Binary file added ArchikaVyas/12_May/Problem02/solution02.exe
Binary file not shown.
Binary file added ArchikaVyas/12_May/Problem03/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading