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
4 Answers
+ 3
for (int i = 0; i < name.length; i++)
System.out.println(i+"."+name[i]);
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;
}
0
thank you guys
0
public class Program {
public static void main(String[] args) {
String[ ] primes = {"apple","manggo"};
for (String t: primes) {
System.out.println(t);
}
}
}