Skip to content

Commit

Permalink
Merge pull request #157 from Kaizo8/shreshth
Browse files Browse the repository at this point in the history
Shreshth
  • Loading branch information
sanghaibiraj authored Apr 11, 2024
2 parents e306c97 + 553b12c commit 6333564
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion easy/day_7/solution.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
//Write your code here
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int t;
cin >> t;
while (t--)
{
long long int d;
cin >> d;
if (d == 1)
{
cout << 6 << endl;
continue;
}

long long int fac1 = 1 + d;
bool p = true;
while (p)
{
for (int i = 2; i < fac1; i++)
{
if ((fac1 % i) == 0)
{
fac1++;
break;
}
if (i == fac1 - 1)
{
p = false;
}
}
}
bool q = true;
long long int fac2 = fac1 + d;
while (q)
{
for (int i = 2; i < fac2; i++)
{
if ((fac2 % i) == 0)
{
fac2++;
break;
}
if (i == fac2 - 1)
{
q = false;
}
}
}

cout << fac1 * fac2 << endl;
}
return 0 ;
}

0 comments on commit 6333564

Please sign in to comment.