1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include <iostream> #include <math.h> using namespace std; int main () { int a,b,c,d,i,j,minimum; cout<<"Enter the all four number "; cin>>a>>b>>c>>d; if(a<b&&a<c&&a<d) minimum=a; else if (b<c&&b<d) minimum=b; else if (c<d) minimum=c; else minimum=d; for(j=minimum;;--j) { if(a%j==0 && b%j==0 && c%j==0&& d%j==0) { break; } } for(i=1;;i++) { if(i%a==0 && i%b==0 &&i%c==0&& i%d==0) break; } cout<<"Lowest Common factor=>"<<i<<endl; cout<<"Highest Common Factor="<<j; } |
a,b=input("Enter the Range Seprated by space ->" ).split(' ') primes=list() for i in range(int(a),int(int(b)+1)): flag=1 for j in range(2,i): if i%j==0: flag=0 break if flag==1: primes.append(i) count=0 for j in primes: if j+6 in primes: count+=1 print(count). example: 4 40 output 7
Comments
Post a Comment
share your thoughts ....