Untitled

mail@pastecode.io avatar
unknown
c_cpp
13 days ago
373 B
0
Indexable
Never
#include <cmath>
#include <iostream>
using namespace std;

bool vool(int c) {
	for (int i = 2; i <= sqrt(c); i++) {
		if (c % i == 0) return false;
	}
	return true;
}

int suma(int a, int b) {
	int sum = 0;
	for (int i = a; i < b; i++) {
		if (vool(i) == 1) sum += i;
	}
	return sum;
}

int main()
{
	int a, b;
	cin >> a >> b;
	cout << suma(a, b);
}
Leave a Comment