Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package divider1;
- public class Divider1 {
- public static void main(String[] args) {
- int number = 100;
- int count = 0;
- for(; number <= 1000;number++){
- if((number % 5 )== 0 &&(number % 6 )== 0 ){
- System.out.print(number + " ");
- count++;
- }
- if(count == 10){
- System.out.println();
- count = 0;
- }
- }
- }
- }
- package divider2;
- public class Divider2 {
- public static void main(String[] args) {
- int number = 100;
- int count = 0;
- for(; number <= 200;number++){
- if(((number % 5 )== 0 || (number % 6 )== 0 ) && (number % 30) != 0){
- System.out.print(number + " ");
- count++;
- }
- if(count == 10){
- System.out.println();
- count = 0;
- }
- }
- }
- }
- package scorefinder1;
- import java.util.Scanner;
- public class ScoreFinder1 {
- public static void main(String[] args) {
- int stuCount;
- String firstName;
- int firstPoint;
- String bestName = "Ege" ;
- int bestPoint = 0;
- Scanner input = new Scanner(System.in);
- System.out.println("How many student are there in the class?");
- stuCount = input.nextInt();
- for(int i = 0; i < stuCount; i++){
- System.out.print("Name: ");
- firstName = input.next();
- System.out.print("Point: ");
- firstPoint = input.nextInt();
- if(firstPoint > bestPoint){
- bestPoint = firstPoint;
- bestName = firstName;
- }
- }
- System.out.println("Best sturdent is " + bestName + " with the point of " + bestPoint);
- }
- }
- package scorefinder2;
- import java.util.Scanner;
- public class ScoreFinder2 {
- public static void main(String[] args) {
- int stuCount;
- String firstName;
- int firstPoint;
- String secName = "Ege";
- int secPoint = 0;
- String bestName = "Ege" ;
- int bestPoint = 0;
- String tempName = "Ege" ;
- int tempPoint = 0;
- Scanner input = new Scanner(System.in);
- System.out.println("How many student are there in the class?");
- stuCount = input.nextInt();
- for(int i = 0; i < stuCount; i++){
- System.out.print("Name: ");
- firstName = input.next();
- System.out.print("Point: ");
- firstPoint = input.nextInt();
- if(firstPoint > secPoint){
- secPoint = firstPoint;
- secName = firstName;
- }
- if(secPoint > bestPoint){
- tempPoint = bestPoint;
- tempName = bestName;
- bestPoint = secPoint;
- bestName = secName;
- secPoint = tempPoint;
- secName = tempName;
- }
- }
- System.out.println("Best sturdent is " + bestName + " with the point of " + bestPoint);
- System.out.println("Second best student is " + secName + " with the point of " + secPoint);
- }
- }
Add Comment
Please, Sign In to add comment