+ 4
how to put enhyphen in printing?
How do i put enhyphen in between the printed number? example 1-2-3-4-5-6-7-8-9-10 this is my code: public class Program { public static void main(String args[]) { int[ ] a={1,2,3,4,5,6,7,8,9,10}; System.out.println("One dimensional array elements are :\n"); for(int i=0;i<a.length;i++) { System.out.print(a[i]); } } } Thank you so much! ❤️
2 Respostas
+ 1
Maybe like this
System.out.print(a[i]);
if(i!=a.length-1)
System.out.print('-');
+ 3
thank you sir Ruba Kh ❤️