You need to sign in to do that
Don't have an account?
Vikram Singh 157
Hi ! is there any issue with code
public class Prime {
Integer i,num;
public void entnum(Integer n){
num = n;
for (i=2; i<=num; i++){
if (system.math.mod(num,i) == 0){
System.debug('Number is not Prime');
break;
}
if(i == num) {
system.debug('Number is Prime');
}
}
}
}
Integer i,num;
public void entnum(Integer n){
num = n;
for (i=2; i<=num; i++){
if (system.math.mod(num,i) == 0){
System.debug('Number is not Prime');
break;
}
if(i == num) {
system.debug('Number is Prime');
}
}
}
}
I fixed your code cheers ..................enjoy
Thank you
Avaneesh Singh
All Answers
Please refer the below code for reference.
- Please follow the best practice while To get familiar with the Apex programming language, Here is a link to the Apex Dev Guide.
- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm
Please mark it as Best Answer if the information is informative.Thanks
Rahul Kumar
I fixed your code cheers ..................enjoy
Thank you
Avaneesh Singh