Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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.
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
+ 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...
}
0
Muchas gracias š, si estĆ” permitida la recursividad, gracias!!