Calculate Simple Interest in Java Output In the above example, we have used the Scanner class to take principal, rate, and time as input from the user. We then use the formula of simple interest to compute the simple interest.
Category: 4. Method (Function)
Convert Binary Number to Decimal Number
Binary numbers are numbers consisting only of 2 digits: 0 and 1. They can be expressed in the base 2 numeral system. For example, Decimal numbers are numbers consisting of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. They can be expressed in the base 10 numeral system. Here, we will be writing a Java program that will convert a binary number into decimal and vice versa using built-in methods and custom… Continue reading Convert Binary Number to Decimal Number
Display Armstrong Number B/w Two Intervals
A positive integer is called an Armstrong number of order n if abcd… = an + bn + cn + dn + … In case of an Armstrong number of 3 digits, the sum of cubes of each digit is equal to the number itself. For example: This program is built on the concept of how to check… Continue reading Display Armstrong Number B/w Two Intervals
Display Prime Numbers Between Two Intervals
Display Prime Numbers Between two Intervals Output In this program, each number between low and high are tested for prime. The inner for loop checks whether the number is prime or not. The difference between checking a single prime number compared to an interval is, you need to reset the value of flag = false on each… Continue reading Display Prime Numbers Between Two Intervals