Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
💩 Swap 6_002 & 6_004
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinNitroG committed Oct 26, 2023
1 parent f7dea19 commit 52f0c91
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
33 changes: 33 additions & 0 deletions Problem_006/6_002.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
#include <iostream>
using namespace std;
int nt(int);

int main()
{
int a[100];
int n;
cin >> n;

for (int i = 0; i < n; i++)
{
cin >> a[i];
}

int flag = 0;
for (int i = 0; i < n; i++)
{
if (nt(a[i]) == 1)
{
flag = 1;
cout << a[i] << " ";
}
}

if (flag == 0)
cout << 0;
return 0;
}

int nt(int n)
{
int dem = 0;
for (int i = 1; i <= n; i++)
if (n % i == 0)
dem++;
if (dem == 2)
return 1;
return 0;
}
33 changes: 0 additions & 33 deletions Problem_006/6_004.cpp
Original file line number Diff line number Diff line change
@@ -1,40 +1,7 @@
#include <iostream>
using namespace std;
int nt(int);

int main()
{
int a[100];
int n;
cin >> n;

for (int i = 0; i < n; i++)
{
cin >> a[i];
}

int flag = 0;
for (int i = 0; i < n; i++)
{
if (nt(a[i]) == 1)
{
flag = 1;
cout << a[i] << " ";
}
}

if (flag == 0)
cout << 0;
return 0;
}

int nt(int n)
{
int dem = 0;
for (int i = 1; i <= n; i++)
if (n % i == 0)
dem++;
if (dem == 2)
return 1;
return 0;
}

0 comments on commit 52f0c91

Please sign in to comment.