import java.util.Scanner;
public class calculationoftwoinput
{
//-----------------------------------------------------------------
// calculate two inputs.
//-----------------------------------------------------------------
public static void main (String[] args)
{
int mark1;
int mark2;
int total;
double average;
Scanner scan = new Scanner (System.in);
System.out.print ("Enter mark1: ");
mark1 = scan.nextInt();
System.out.print ("Enter mark2: ");
mark2 = scan.nextInt();
total = mark1 + mark2;
average = total/2;
System.out.println ("Total mark is : " + total);
System.out.println ("Average mark is: " + average);
}
}
GO TO CHAPTER 3
Browse: Home > scanner function(average)
0 Comments:
Post a Comment