Else If Statement Example Program in Dart


Example Program:

Here is the simple program for printing basic example of else if statement in dart.

Source Code

import 'dart:io';
void main() {
   var pre,cur,amt,unit;
   print('Enter Pervious Unit : ');
   pre=int.parse(stdin.readLineSync());
   print('Enter Current Unit : ');
   cur=int.parse(stdin.readLineSync());
   unit=cur-pre;
   if(unit==0)
    {
       print('You Need to pay Rs: 50 ');
    }
	else if(unit>=1 && unit<=100)
	{
       amt=unit*0.50;
       print('You Need to pay Rs: $amt ');
   }
   else if(unit>=101 && unit<=200)
   {
       amt=unit*1.50;
       print('You Need to pay Rs: $amt ');
   }
   else
   {
       amt=unit*3.00;
       print('You Need to pay Rs: $amt ');
   }

}
To download raw file Click Here

Output

Enter Pervious Unit : 
20
Enter Current Unit : 
30
You Need to pay Rs: 5.0 


Learn All in Tamil © Designed & Developed By Tutor Joes