In this post we have given a simple java program to save the student data and display the data to the user.
program:
import java.util.Scanner;
class Student{
public static void main(String[] args){
int n;
System.out.println("Enter the number of students");
Scanner sc=new Scanner(System.in);
int a[]=new int[10];
String b[]=new String[10];
n=sc.nextInt();
System.out.println(n);
for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
b[i]=sc.next();
}
System.out.println("student details");
System.out.println("REGISTER NO"+"\t\t"+"NAME");
for(int i=0;i<n;i++)
{
System.out.println("\t"+a[i]+"\t\t\t\t"+b[i]+"\n");
}
}
}
INPUT
2
1
IRAGUL
2
GOWTHAM
OUTPUT
REGISTER NO NAME
1 IRAGUL
2 GOWTHAM
إرسال تعليق