function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger fact on Object__c (before Insert, before Update) { for(Object__c m : Trigger.new) { if(trigger.isInsert || trigger.isUpdate) { long fac=1; for(integer j = 1; j<= m.Factorial__c; j++) { fac = fac * j; } m.Output_of_the_Factorial__c = 'Factorial of ' + m.Factorial__c + ' = ' + fac; } } }
public class FindFactorial { public static void fact(Integer num){ Long answer = 0; while(num != 0){ answer = answer * num; num--; } system.debug(answer); } }
Check below example for facorial of number.
https://salesforceforfresher.wordpress.com/2021/06/13/factorial-salesforce-apex-trigger/
Please mark as Best Answer if above information was helpful.
Thanks,
You can use this sample
Please mark it as best answer if it helps you.
Thanks.