Untitled

mail@pastecode.io avatar
unknown
plain_text
19 days ago
377 B
1
Indexable
Never
#include <iostream>
#include <cmath>
using namespace std;

int s(int a, int b) {
	int summ = 0;
	bool h = 0;
	int i;
	while (a <= b) {
		i = 2;
		h = 0;
		while (i <= sqrt(a)) {
			if (a % i == 0)
				h = 1;
			i++;
		}
		if (h == 0) {
			summ += a;
		}
		a++;
	}
	return summ;
}
int main(){
	int a, b;
	cin >> a >> b;
	cout << s(a, b);
	return 0;
}
Leave a Comment