Home
О нас
Products
Services
Регистрация
Войти
Поиск
FastomWisp
@FastomWisp
November 2021
1
18
Report
C++ помогите плиз, срочно
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
BrightOne
#include <iostream>
#include <math.h>
using namespace std;
bool isPrime(int x)
{
for (int i = 2; i <= sqrt(x); i++) {
if (x % i == 0) return false;
}
return true;
}
int main()
{
int n;
cout << "n = ";
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
a[i] = rand() % 20;
if ( isPrime(a[i]) ) {
cout << a[i] << ' ';
}
}
return 0;
}
0 votes
Thanks 0
More Questions From This User
See All
FastomWisp
August 2022 | 0 Ответы
5y''-y'=0 y(0)=1; y'(0)=-2...
Answer
FastomWisp
August 2022 | 0 Ответы
дифференциальные уравнения y''-12y'+35y=0 y(0)=3,y'(0)=-4...
Answer
FastomWisp
August 2022 | 0 Ответы
9y''+6y'+y=0 y(0)=-5;y'(0)=4...
Answer
FastomWisp
March 2022 | 0 Ответы
Срочно y''-8y'+7y=2*e^5x...
Answer
FastomWisp
May 2021 | 0 Ответы
50 баллов дифференциальные уравнения y''-12y'+35y=0 y(0)=3,y'(0)=-4...
Answer
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
о чем должны позаботиться в первую очередь взрослые при организационном вывозе н...
danilarsentev
August 2022 | 0 Ответы
Есть два станка на которых выпускают одинаковые запчасти один производит a запча...
myachina8
August 2022 | 0 Ответы
Найти по графику отношение V3:V1. В ответах написано 9, но нужно решение...
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
Определите Как создавалась и кто создавал арабское государство в крации...
MrZooM222
August 2022 | 0 Ответы
Ч. Айтманов в рассказе "Красное яблоко" использует метод рассказ в рассказе. Опи...
timobila47
August 2022 | 0 Ответы
каково было назначение каждой из частей византийского храма? помогите пожалуйста...
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
Участник Знаний
August 2022 | 0 Ответы
Пожалуйста!!!!!!!!!!!!...
sarvinozwakirjanova
August 2022 | 0 Ответы
помогите пожалусто пж...
×
Report "C++ помогите плиз, срочно..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <math.h>
using namespace std;
bool isPrime(int x)
{
for (int i = 2; i <= sqrt(x); i++) {
if (x % i == 0) return false;
}
return true;
}
int main()
{
int n;
cout << "n = ";
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
a[i] = rand() % 20;
if ( isPrime(a[i]) ) {
cout << a[i] << ' ';
}
}
return 0;
}