PROGRAM
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Race
{
public
static void main(String a[]) throws IOException
{
int
r1,r2,r3,r4,r5,avg;
BufferedReader
br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter
the speed of the r1:");
System.out.println("enter
the speed of the r2:");
System.out.println("enter
the speed of the r3:");
System.out.println("enter
the speed of the r4:");
System.out.println("enter
the speed of the r5:");
r1=Integer.parseInt(br.readLine());
r2=Integer.parseInt(br.readLine());
r3=Integer.parseInt(br.readLine());
r4=Integer.parseInt(br.readLine());
r5=Integer.parseInt(br.readLine());
avg=(r1+r2+r3+r4+r5)/5;
if(r1>avg)
{
System.out.println("first
racer is qualified with a race speed "+r1+"\n");
}
else
if(r2>avg)
{
System.out.println("second
racer is qalified with a race speed "+r2);
}
else
if(r3>avg)
{
System.out.println("third
racer is qalified with a race speed "+r3);
}
else
if(r4>avg)
{
System.out.println("fourth
racer is qalified with a race speed "+r4);
}
else
if(r5>avg)
{
System.out.println("fifth
racer is qalified with a race speed "+r5);
}
else
{
System.out.println("no
biker is qualified");
}
}
}
Output:
No comments:
Post a Comment