@[pengzhihao](/user/1380072)
```c
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
cin>>n;
if(n%3!=0&&n%5!=0&&n%7!=0)
{
cout<<"n";
return 0;
}
else
{
if(n%3==0)cout<<"3 ";
if(n%5==0)cout<<"5 ";
if(n%7==0)cout<<"7";
}
return 0;
}
```
by mairuisheng @ 2024-06-28 21:32:04
@[pengzhihao](/user/1380072) 这题不就几个if吗
by losti @ 2024-06-28 21:32:50
棒棒的
by pengzhihao54188 @ 2024-06-28 21:34:12
@[pengzhihao](/user/1380072) 是刚接触C++吗?
by mairuisheng @ 2024-06-28 21:36:32
```cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
long long a;
cin>>a;
if(a%3==0){
cout<<"3 ";}
if(a%5==0){
cout<<"5 ";}
if(a%7==0){
cout<<"7";}
if(a%3>0 && a%5>0 && a%7>0){
cout<<"n";}
}
```
by chenjiayuan666 @ 2024-06-30 18:10:16
这样的
```
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long x;
cin>>x;
if(x%3==0)
{
cout<<"3 ";
}
if(x%5==0)
{
cout<<"5 ";
}
if(x%7==0)
{
cout<<"7 ";
}
else if(x%3!=0)
{
if(x%5!=0)
{
if(x%7!=0)
{
cout<<"n";
}
}
}
}
```
by DuduK @ 2024-07-16 17:43:14
@[mairuisheng](/user/1328579)
```
#include<iostream>
using namespace std;
int main(){
long a;
cin>>a;
if (a % 3 == 0){
cout<<"3 ";
}
if (a % 5 == 0){
cout<<"5 ";
}
if (a % 7 == 0){
cout<<"7 ";
}
if (a % 3 != 0 && a % 5 != 0 && a % 7 != 0){
cout<<"n";
}
return 0;
}
```
by HuXuanHao123456 @ 2024-07-25 09:21:32
@[chenjiayuan666](/user/1354587)
不用缩进吗?
by HuXuanHao123456 @ 2024-07-25 09:22:50