Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class P27Ex39
- {
- static Scanner reader= new Scanner(System.in);
- public static void main(String[] args)
- {
- int first=0 , sec=0 , th=0 , v1 , v2 , v3;
- int[] comp=new int[51];
- for (int i=1 ; i<=10 ; i++)
- {
- System.out.println(" הכנס מקום ראשון , שני , ושלישי ");
- v1=reader.nextInt();
- v2=reader.nextInt();
- v3=reader.nextInt();
- comp[v1]+=3;
- comp[v2]+=2;
- comp[v3]+=1;
- }
- if ( comp [1] > comp[2])
- {
- first=comp[1];
- sec=comp[2];
- }
- else
- {
- first=comp[2];
- sec=comp[1];
- }
- for ( int i=3 ; i<comp.length ; i++)
- {
- if ( comp[i]>first)
- {
- th=sec;
- sec=first;
- first=comp[i];
- }
- else if (comp[i]>sec)
- {
- th=sec;
- sec=comp[i];
- }
- else if (comp[i]>th)
- th=comp[i];
- }
- System.out.println("מקום ראשון : " + first + " מקום שני : " + sec + "מקום שלישי" + th);
- }
- }
Add Comment
Please, Sign In to add comment