Skip to main content
Small changes of formatting.
Source Link
Sergey Kalinichenko
  • 729.1k
  • 85
  • 1.2k
  • 1.6k

I am learning how for loops work. I need to print the values

1a 2b 3c

1a 2b 3c 

This is what I have tried so far:

int [] numbers ={1, 2, 3};   String [] letters = {"a","b","c"};   for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); }  } 

This code is obviously not working. It gave me

1a 1b 1c 2a 2b 2c 3a 3b 3c

1a 1b 1c 2a 2b 2c 3a 3b 3c 

How can I fix the loop to give a result of "1a 2b 3c"1a 2b 3c?

I am learning how for loops work. I need to print the values

1a 2b 3c

This is what I have tried so far:

int [] numbers ={1, 2, 3};   String [] letters = {"a","b","c"};   for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); }  } 

This code is obviously not working. It gave me

1a 1b 1c 2a 2b 2c 3a 3b 3c

How can I fix the loop to give a result of "1a 2b 3c"?

I am learning how for loops work. I need to print the values

1a 2b 3c 

This is what I have tried so far:

int [] numbers ={1, 2, 3}; String [] letters = {"a","b","c"}; for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); } } 

This code is obviously not working. It gave me

1a 1b 1c 2a 2b 2c 3a 3b 3c 

How can I fix the loop to give a result of 1a 2b 3c?

English
Source Link
khelwood
  • 59.7k
  • 14
  • 91
  • 116

i'mI am learning how for loops works, iloops work. I need to print the values "1a 2b 3c". this's

1a 2b 3c

This is what iI have tried so far:

int [] numbers ={1, 2, 3}; String [] letters = {"a","b","c"}; for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); } } 

This code is obviously not working. It gave me 1a 1b 1c 2a 2b 2c 3a 3b 3c

1a 1b 1c 2a 2b 2c 3a 3b 3c

howHow can I fix the loop to give a result of "1a 2b 3c"?

i'm learning how for loops works, i need to print the values "1a 2b 3c". this's what i tried so far:

int [] numbers ={1, 2, 3}; String [] letters = {"a","b","c"}; for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); } } 

This code obviously not working gave me 1a 1b 1c 2a 2b 2c 3a 3b 3c

how fix the loop to give a result of "1a 2b 3c"

I am learning how for loops work. I need to print the values

1a 2b 3c

This is what I have tried so far:

int [] numbers ={1, 2, 3}; String [] letters = {"a","b","c"}; for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); } } 

This code is obviously not working. It gave me

1a 1b 1c 2a 2b 2c 3a 3b 3c

How can I fix the loop to give a result of "1a 2b 3c"?

Post Closed as "Duplicate" by Sotirios Delimanolis java
Source Link
Mounir Elfassi
  • 2.3k
  • 3
  • 24
  • 38

For loop 1a ,2b, 3c... in java

i'm learning how for loops works, i need to print the values "1a 2b 3c". this's what i tried so far:

int [] numbers ={1, 2, 3}; String [] letters = {"a","b","c"}; for (int n: numbers){ for( String l:letters){ Log.i("sas","Result " + n +l); } } 

This code obviously not working gave me 1a 1b 1c 2a 2b 2c 3a 3b 3c

how fix the loop to give a result of "1a 2b 3c"