
LCM, SUM OF N NUMBERS, FACTORIAL
LCM-LEAST COMMON MULTIPLE FLOW CHART ##TO BE DISCUSS PYTHON CODE: no1 = int ( input ( " enter 1st number " )) no2 = int ( input ( " enter 2ed number " )) big = no1 if no1 > no2 else no2 big2 = big while True : if big % no1 == 0 and big % no2 == 0 : print ( big ) break big += big2 OUTPUT: JAVA CODE: public class LCMExample { public static void main ( String [] args ) { int no1 = 4 ; int no2 = 6 ; int big = ( no1 > no2 ) ? no1 : no2 ; int big2 = big ; while ( true ) { if ( big % no1 == 0 && big % no2 == 0 ) { System . out . println ( "LCM: " + big ); break ; } big += big2 ; } } } OUTPUT: JAVA SCRIPT CODE: let no1 = Number ( prompt ( " Enter your Number " )) let no2 = Number ( prompt ( " Enter your Number " )) let big = no1 > no2 ? no1 : no2 let big2 = big while ( true ) { if ( big % no1 == 0 && big % no2 == 0 ) { console . log ( " LCM " , big ); break ; } big += big2 } OUTPUT: SUM OF N NUMBERS FLOW CHART: PYTHON CODE: sum = 0 no = 1 while no <= 10 : sum = sum + no no += 1 print ( sum ) O
Continue reading on Dev.to Beginners
Opens in a new tab


