File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Roadmap/02 - FUNCIONES Y ALCANCE Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ public static void main(String[] args) {
1919 System .out .println ("La resta es " + resultados [0 ] + " y la division es " + resultados [1 ]);
2020 // Variables Global y Local
2121 my_Function ();
22+
23+ //EXTRA
24+ EXTRA ("FIZZ" , "BUZZ" );
2225 }
2326
2427 // Función Básica
@@ -63,7 +66,22 @@ public static void my_Function(){
6366
6467 /**-----DIFICULTAD EXTRA-----*/
6568
66- // Pendiente
69+ public static int EXTRA (String text1 , String text2 ){
70+ int cont = 0 ;
71+ for (int number = 1 ; number <= 100 ; number ++){
72+ if (number % 3 == 0 && number % 5 == 0 ) {
73+ System .out .println (text1 + text2 );
74+ } else if (number % 3 == 0 ){
75+ System .out .println (text1 );
76+ } else if (number % 5 == 0 ){
77+ System .out .println (text2 );
78+ } else {
79+ System .out .println (number );
80+ }
81+ cont ++;
82+ }
83+ return cont ;
84+ }
6785
6886 /**-----DIFICULTAD EXTRA-----*/
6987}
Original file line number Diff line number Diff line change @@ -52,3 +52,18 @@ def my_function():
5252"""
5353EXTRA
5454"""
55+ def extra (text1 , text2 ) -> int :
56+ cont = 0
57+ for number in range (1 , 101 ):
58+ if number % 3 == 0 and number % 5 == 0 :
59+ print (text1 )
60+ elif number % 3 == 0 :
61+ print (text2 )
62+ elif number % 5 == 0 :
63+ print (text1 + text2 )
64+ else :
65+ print (number )
66+ cont += 1
67+ return print (f"Las veces que aparece las letras { cont } " )
68+
69+ extra ("FIZZ" ,"BUZZ" )
You can’t perform that action at this time.
0 commit comments