You need to sign in to do that
Don't have an account?
Kumar__Mayank
How can I see complete prime numbers between 1 and 100 in LOG?
integer i=0;
integer num=0;
while( i <= 100)
{
//system.debug('here' + i);
integer counter=0;
for (num = i ;num >= 1; num--)
{
if(math.mod(i,num)==0)
{
counter=counter+1;
}
}
if (counter == 2)
{
system.debug(i);
}
i++;
}
Above code I am running in anonymous window to get prime numbers between 1 to 100. But when I go for Debug Only it shows like this:
Any body can tell me how to get complete prime numbers here?
integer num=0;
while( i <= 100)
{
//system.debug('here' + i);
integer counter=0;
for (num = i ;num >= 1; num--)
{
if(math.mod(i,num)==0)
{
counter=counter+1;
}
}
if (counter == 2)
{
system.debug(i);
}
i++;
}
Above code I am running in anonymous window to get prime numbers between 1 to 100. But when I go for Debug Only it shows like this:
Any body can tell me how to get complete prime numbers here?
I hope this helps