si se lee N=7 , se imprimirĆ” 0,1,2,3,4,5,6,7 | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

si se lee N=7 , se imprimirĆ” 0,1,2,3,4,5,6,7

Alguien que me pueda ayudar con este ejercicio por favor, es en Java :c . Hacer un programa que lea un numero N y que imprima todos los nĆŗmero desde 0 a hasta N. Ejemplo: si se lee N=7 , se imprimirĆ” 0,1,2,3,4,5,6,7 NOTA: no se pueden usar ciclos.

13th Oct 2020, 8:53 AM
Ana Patricia QuiƱonez Arreola
Ana Patricia QuiƱonez Arreola - avatar
3 Respostas
+ 3
Write input statement in for loop for multiple input or create one array which size will be 7 like this int array[7] and use for loop and write input statement inside loop Read here how to take input https://www.javatpoint.com/java-program-to-read-number-from-standard-input
13th Oct 2020, 9:21 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
NOTA: No se pueden utilizar ciclos. ĀæAquĆ­ ciclos significa? Bucles? ĀæEstĆ” permitida la recursividad? Si es asĆ­, utilice la variable estĆ”tica para N. Lleve la entrada a N. Llame a una funciĆ³n que imprima M (de 0 a N) llame de forma recursiva con M + 1 hasta M == N o Hasta M <= N .. (translated this) NOTE: Cycles cannot be used. Here cycles means? Loops? Is recursion is allowed? If yes, then use static variable for N. Take input to N. Call a function which prints M (from 0 to N) recursively call with M+1 until M==N or Until M<=N.. Edit : Ex : Ana Patricia QuiƱonez Arreola print(M); //calling method static void print(int M) { System.out.println(M); if(M<=N) print(M+1); //recursively calling this method... }
13th Oct 2020, 10:05 AM
Jayakrishna šŸ‡®šŸ‡³
0
Muchas gracias šŸ˜Œ, si estĆ” permitida la recursividad, gracias!!
13th Oct 2020, 4:53 PM
Ana Patricia QuiƱonez Arreola
Ana Patricia QuiƱonez Arreola - avatar