write a program to print your name,class,rollno, marks and age. Name this file, mu profile
Answers
Answer:
Java Program
import java.util.*;
class MyProfile
{
public void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter your name");
String n=sc.next();
System.out.println("Enter your class");
int c=sc.nextInt();
System.out.println("Enter your marks");
int m=sc.nextInt();
System.out.println("Enter your roll number");
int rn=sc.nextInt();
System.out.println("My profile"):
System.out.println("Name :"+n);
System.out.println("Class "+c);
System.out.println("Roll number "+rn);
System.out.println("Marks "+m);
}
}
---------------------------------------------------------------
Hope it helps !
____________________________________________________________________
Answer:
def insertRec():
rollno = int(input('Enter roll number:'))
name = input('Enter Name:')
marks = int(input('Enter Marks'))
rec = {'Rollno':rollno,'Name':name,'Marks':marks
f = open('student.dat','ab')
pickle.dump(rec,f)
f.close()
Explanation: