Scala - Find the division of a student based on a given percentage Code Example

The code for Find the division of a student based on a given percentage

// Scala program to find the division of a student based 
// on given percentage

object Sample{  
  def main(args:Array[String]){  
    var per:Float = 0;
    
    print("Enter percentage:")
    per=scala.io.StdIn.readFloat()
    
    if(per>=60 && per<=100)
      println("First Division")
    else if(per>=45 && per<=59)
      println("Second Division")
    else if(per>=33 && per<=44)
      println("Third Division")
    else
      println("Sorry, you are FAILED")
  }
}


/*
Output:
Enter percentage:52.65
Second Division
*/
Code by IncludeHelp, on August 12, 2022 23:14

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.