Multiplication Pattern -
/* 10*2 =20 20*2 =40 40*2 =80 80*2 =160 160*2 =320 */ public class Apptitude { public static void multiplicationPattern1(Integer num) { Integer n = num; for(Integer i=0;i<n;i++) { system.debug(Integer.valueOf((math.pow(2, i)*10))+'*2 ='+Integer.valueOf((math.pow(2, i)*20))+'\n'); } } } |
No comments:
Post a Comment