0

Guys can you please help me how to take the name of the inside of the array string for ex: String[] name={"apple","manggo"};

usinf for loops. and want the output will like this 1.apple 2.manggo

15th Mar 2017, 10:38 AM
feri
4 odpowiedzi
+ 3
for (int i = 0; i < name.length; i++) System.out.println(i+"."+name[i]);
15th Mar 2017, 6:31 PM
Rrestoring faith
Rrestoring faith - avatar
0
string name[5]; cout<<"Enter 5 fruit name one by one"; for(int i=0;i<=5;i++) {getline(cin,name[i]); } for(int j=0;j<=5;j++) { cout<<j+1<<"."<<name[j]<<endl; }
15th Mar 2017, 3:38 PM
Danish Ali
Danish Ali - avatar
0
thank you guys
15th Mar 2017, 11:05 PM
feri
0
public class Program { public static void main(String[] args) { String[ ] primes = {"apple","manggo"}; for (String t: primes) { System.out.println(t); } } }
22nd Jun 2017, 4:29 AM
Muhannad