Skip to content

Instantly share code, notes, and snippets.

@farhanpro
Created December 19, 2018 18:55
Show Gist options
  • Save farhanpro/b2ba35095f682d245beb9e31c0eac573 to your computer and use it in GitHub Desktop.
Save farhanpro/b2ba35095f682d245beb9e31c0eac573 to your computer and use it in GitHub Desktop.
intrest rate calculator using for loop
package com.company;
public class Main {
public static void main(String[] args) {
for(int i=0;i<5;i++){
double solution = calculate_interst(10000d,i);
System.out.println("On " + i + "% it will be");
System.out.println(solution + " $");
}
}
public static double calculate_interst(double amount ,double intrest_rate ){
//System.out.println(amount *(intrest_rate /100));
return (amount*(intrest_rate/100));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment