/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.testprojects;
import java.util.Scanner;
/**
*
* @author rajesh shukla
*/
public class student {
public static void main(String[] args)
{
int total, score1,score2;
int percentage1,percentage2;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the total marks: ");
total = sc.nextInt();
System.out.println("Enter the score frist student marks: ");
score1 = sc.nextInt();
System.out.println("Enter the score second student marks: ");
score2 = sc.nextInt();
percentage1 = (score1 * 100/ total);
percentage2=(score2 * 100/ total);
System.out.println("The percentage of frist student = " + percentage1 + " %");
System.out.println("The percentage of second student = " + percentage2 + " %");
if(percentage1>percentage2)
{
System.out.println("highest percentage of frist student");
}
else
{
System.out.println("highest percentage of second student");
}
}
}
0 comments:
Post a Comment