งง code java ครับ เกี่ยวกับ Array and Loop

แนะนำ สอบถาม ภาษา C สำหรับผู้เริ่มต้น

Moderator: phpbb, mindphp, ผู้ดูแลกระดาน

ตอบกลับโพส
aplusing
phpBBThailand Newbie
phpBBThailand Newbie
โพสต์: 1
ลงทะเบียนเมื่อ: 15 ก.ย. 2014, 22:54

งง code java ครับ เกี่ยวกับ Array and Loop

โพสต์ โดย aplusing »

ผมงง ครับ ยังไงผมก็ทำไม่ได้ซักที ผมเพิ่งเริ่มเรียน Java ครับ
ผมต้องการแบบนี้หน่ะครับ

Enter Student : 5 ใส่จำนวน 5 คน หรือมากกว่านั้น

Student 1 :
Student 2 :
Student 3 :
Student 4 :
Student 5 :

เวลาใส่เลขจำนวน n Student ก็จะออก มาจำนวน n ที่เราใส่ครับ
qtscc
phpBBThailand Newbie
phpBBThailand Newbie
โพสต์: 1
ลงทะเบียนเมื่อ: 06 ส.ค. 2015, 13:29

Re: งง code java ครับ เกี่ยวกับ Array and Loop

โพสต์ โดย qtscc »

โค้ด: เลือกทั้งหมด

Scanner sc = new Scanner(System.in);
		int student = sc.nextInt();
		for(int i=1;i<=student;i++)
			System.out.println("Student "+i);
ตอบกลับโพส

ย้อนกลับไปยัง

ผู้ใช้งานขณะนี้

กำลังดูบอร์ดนี้: 5 และ บุคคลทั่วไป 0 ท่าน