/* Simple intro of a student using Scanner class in java */
import java.util.*;
class Student
{
public static void main(String[] args)
{
int roll;
String name,branch;
Scanner s=new Scanner(System.in);
System.out.println("Enter roll number : ");
roll=s.nextInt();
// System.out.println("Enter marks number : ");
// float f=s.nextFloat();
System.out.println("Enter branch of the student : ");
branch=s.next();
System.out.println("Enter name of the student : ");
name=s.next();
System.out.println("Name is :"+name);
System.out.println("Branch is : "+branch);
System.out.println("Roll no is : "+roll);
}
}
output
Enter roll number :
21
Enter branch of the student :
cse
Enter name of the student :
sanjay
Name is :sanjay
Branch is : cse
Roll no is : 21
import java.util.*;
class Student
{
public static void main(String[] args)
{
int roll;
String name,branch;
Scanner s=new Scanner(System.in);
System.out.println("Enter roll number : ");
roll=s.nextInt();
// System.out.println("Enter marks number : ");
// float f=s.nextFloat();
System.out.println("Enter branch of the student : ");
branch=s.next();
System.out.println("Enter name of the student : ");
name=s.next();
System.out.println("Name is :"+name);
System.out.println("Branch is : "+branch);
System.out.println("Roll no is : "+roll);
}
}
output
Enter roll number :
21
Enter branch of the student :
cse
Enter name of the student :
sanjay
Name is :sanjay
Branch is : cse
Roll no is : 21
No comments:
Post a Comment