Advertisement
vvccs

[X]E7_File_I/O

Oct 26th, 2023 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. import java.io.*;
  2. class simst
  3. {
  4. public static void main(String[] args) throws IOException
  5. {
  6. BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
  7. String snm[]=new String[100];
  8. String a;
  9. int n;
  10. Int m[][]=new int[10][20];  
  11. System.out.println("How many students are there?");  
  12. a=br.readLine();
  13. n=Integer.parseInt(a);
  14. for(int i=1;i<=n;i++)
  15. {
  16. System.out.println("Enter the name of student no:"+i);
  17. snm[i]=br.readLine();
  18. for(int j=1;j<=2;j++)
  19.  
  20.  
  21. {
  22. System.out.println("Enter the marks of "+i+"th students of"+j+"th subject");
  23. a=br.readLine();
  24. m[i][j]=Integer.parseInt(a);
  25.  
  26. }
  27. }
  28. System.out.println("\n  ");
  29. System.out.println("\tName\t\t1stSub\t\t2ndSub");
  30. System.out.println(" ");
  31. for(int i=1;i<=n;i++)
  32. {
  33. System.out.print("\t"+snm[i]);  
  34. for(int j=1;j<=2;j++)
  35. {
  36. System.out.print("\t\t"+m[i][j]);
  37. }
  38. System.out.println("\n");
  39. }
  40. System.out.println(" ");
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement