Witam. Mam do napisania program, który wykona różne myki, ale z tym nie mam problemu... Mam mianowicie z błędem:
[code]invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’[/code]
#include<iostream>
#include<math.h>
using namespace std;
int main() {
int a,b,c,n;
int sum=0;
cin >> a;
for(b=0;b<a;b++) {
cin >> n;
while(n != 1) {
if(sqrt(n)%1==0) {
if(sqrt(n)<=1) {
n=sqrt(n);
}
}
else {
n=n-1;
}
sum++;
}
cout << sum << endl;
}
return 0;
}
Proszę bardzo o wskazanie błędu jak najszybciej.