Sunday, 5 November 2017

java program that take three subjects number fron the user andcheck



Problem 05:
Write a program that take three subject numbers and calculate its average if average is greater then 80 print you are applicable for admission here.
Discripition:
Take three number average and pass it through an if statement.
Solution:
import java.util.*;
public class Message {
 public static void main(String[] args) {
  Scanner input= new Scanner(System.in);
   System.out.println("Enter the frist subject number");
    int num1=input.nextInt();
    System.out.println("Enter the Second subject number");
    int num2=input.nextInt();
  System.out.println("Enter the Second subject number");
    int num3=input.nextInt();
 float avg=(num1+num2+num3)/3;
    if(avg>=80)
        System.out.println("you are applicable to got admission in this university");
      }}
Output:

No comments:

Post a Comment