Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11may and 12 may #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Binary file added vijay bissa/11 may/q1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions vijay bissa/11 may/q1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def findSingle( ar, n):

res = ar[0]

for i in range(1,n):
res = res ^ ar[i]

return res


print("Enter The Numbers:- ")
ar= list(map(int,input().split()))
print ("Element occuring once is", findSingle(ar, len(ar)))
Binary file added vijay bissa/11 may/q4..png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions vijay bissa/11 may/q4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
A=int(input("Enter the size of Grid:- "))
if A<0:
print(1)
else:
arr=[0 for i in range(A+2)]
arr[0]=arr[1]=1
for i in range(2,A+1):
for j in range(i+1):
arr[i]=(arr[i]+arr[j]*arr[i-j-1])%(10**9+7)
print(arr[A-1])
Binary file added vijay bissa/11 may/q5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions vijay bissa/11 may/q5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
num=int(input("Enter the number to find Square Root:-"))
f=0
if(num==0 or num==1):
print(num)
st=1
end=num
while(st<=end):
mid=(st+end)//2
if(mid**2==num):
print(mid)
f=1
if(mid**2<num):
st=mid+1
ans = mid
else:
end=mid-1
if(f==0):
print(ans)
70 changes: 70 additions & 0 deletions vijay bissa/12 may/q1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include<bits/stdc++.h>
using namespace std;
bool prime(int n)
{
int f=0;
for(int i=2;i<=(n/2);i++)
{
if(n%i==0)
{
f=1;
break;
}
}
if(f==1)
{
return false;
}
else
{
return true;
}
}


int main()
{
int r,c,count=0,i,j;
cout<<"\nEnter number of rows : ";
cin>>r;
cout<<"\nEnter number of columns : ";
cin>>c;
int arr[r][c];
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<"\n Enter element : "<<i+1<<j+1<<" : ";
cin>>arr[i][j];
}
}
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
int sum=0;
if(i+1<r)
{
sum += arr[i+1][j];
}
if(i-1>=0)
{
sum += arr[i-1][j];
}
if(j+1<c)
{
sum += arr[i][j+1];
}
if(j-1>=0)
{
sum += arr[i][j-1];
}
if(prime(sum))
{
count++;
}

}
}
cout<<"Result = "<<count<<endl;
}
Binary file added vijay bissa/12 may/q1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions vijay bissa/12 may/q2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include<bits/stdc++.h>
using namespace std;
int main()
{
int r,count=0,i,j;
cout<<"\nEnter size of nxn matrix : ";
cin>>r;
int arr[r][r];
for(i=0;i<r;i++)
{
for(j=0;j<r;j++)
{
cout<<"\n Enter element : "<<i+1<<j+1<<" : ";
cin>>arr[i][j];
}
}
int n;
cout<<"Enter number for search : ";
cin>>n;
i=0;
j=0;
int f=0;
while(i<r && j<r)
{
if(arr[i][j]==n)
{
cout<<"Number found at position ("<<i<<" , "<<j<<")"<<endl;
f=1;
break;
}
if(arr[i][j+1]<n && j+1<r)
{
j=j+1;
}
else
{
i=i+1;
}
}
if(f==0)
{
cout<<"Number not found"<<endl;
}
}
Binary file added vijay bissa/12 may/q2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions vijay bissa/12 may/q3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include<bits/stdc++.h>
using namespace std;
bool odd(int n)
{
if (n%2==0)
{
return false;
}
else
{
return true;
}
}
int main()
{
int r,c,count=0,i,j;
cout<<"\nEnter number of rows : ";
cin>>r;
cout<<"\nEnter number of columns : ";
cin>>c;
int arr[r][c];
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<"\n Enter element : "<<i+1<<j+1<<" : ";
cin>>arr[i][j];
}
}
for(i=0;i<c;i++)
{
int c=0;
for(j=0;j<r;j++)
{
if(arr[j][i]==1)
{
c++;
}
}
if(odd(c))
{
count++;
}
}
cout<<"Total number of columns having odd number of 1's is : "<<count<<endl;
}

Binary file added vijay bissa/12 may/q3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.