Guest User

Untitled

a guest
Oct 21st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. package divider1;
  2.  
  3. public class Divider1 {
  4.  
  5. public static void main(String[] args) {
  6. int number = 100;
  7. int count = 0;
  8. for(; number <= 1000;number++){
  9. if((number % 5 )== 0 &&(number % 6 )== 0 ){
  10. System.out.print(number + " ");
  11. count++;
  12. }
  13. if(count == 10){
  14. System.out.println();
  15. count = 0;
  16. }
  17. }
  18. }
  19. }
  20.  
  21. package divider2;
  22.  
  23. public class Divider2 {
  24.  
  25. public static void main(String[] args) {
  26. int number = 100;
  27. int count = 0;
  28. for(; number <= 200;number++){
  29. if(((number % 5 )== 0 || (number % 6 )== 0 ) && (number % 30) != 0){
  30. System.out.print(number + " ");
  31. count++;
  32. }
  33. if(count == 10){
  34. System.out.println();
  35. count = 0;
  36. }
  37. }
  38. }
  39. }
  40.  
  41. package scorefinder1;
  42.  
  43. import java.util.Scanner;
  44.  
  45. public class ScoreFinder1 {
  46.  
  47. public static void main(String[] args) {
  48. int stuCount;
  49. String firstName;
  50. int firstPoint;
  51. String bestName = "Ege" ;
  52. int bestPoint = 0;
  53. Scanner input = new Scanner(System.in);
  54. System.out.println("How many student are there in the class?");
  55. stuCount = input.nextInt();
  56. for(int i = 0; i < stuCount; i++){
  57. System.out.print("Name: ");
  58. firstName = input.next();
  59. System.out.print("Point: ");
  60. firstPoint = input.nextInt();
  61. if(firstPoint > bestPoint){
  62. bestPoint = firstPoint;
  63. bestName = firstName;
  64. }
  65. }
  66. System.out.println("Best sturdent is " + bestName + " with the point of " + bestPoint);
  67. }
  68.  
  69. }
  70.  
  71. package scorefinder2;
  72.  
  73. import java.util.Scanner;
  74.  
  75. public class ScoreFinder2 {
  76.  
  77. public static void main(String[] args) {
  78. int stuCount;
  79. String firstName;
  80. int firstPoint;
  81. String secName = "Ege";
  82. int secPoint = 0;
  83. String bestName = "Ege" ;
  84. int bestPoint = 0;
  85. String tempName = "Ege" ;
  86. int tempPoint = 0;
  87. Scanner input = new Scanner(System.in);
  88. System.out.println("How many student are there in the class?");
  89. stuCount = input.nextInt();
  90. for(int i = 0; i < stuCount; i++){
  91. System.out.print("Name: ");
  92. firstName = input.next();
  93. System.out.print("Point: ");
  94. firstPoint = input.nextInt();
  95. if(firstPoint > secPoint){
  96. secPoint = firstPoint;
  97. secName = firstName;
  98. }
  99. if(secPoint > bestPoint){
  100. tempPoint = bestPoint;
  101. tempName = bestName;
  102. bestPoint = secPoint;
  103. bestName = secName;
  104. secPoint = tempPoint;
  105. secName = tempName;
  106. }
  107. }
  108. System.out.println("Best sturdent is " + bestName + " with the point of " + bestPoint);
  109. System.out.println("Second best student is " + secName + " with the point of " + secPoint);
  110. }
  111.  
  112. }
Add Comment
Please, Sign In to add comment