Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

[HELP] Math.pow

$
0
0
Hi, This is my working code but I want to change the calculations from double to int, but when I change the double with int i get an error. Can someone explain?
import java.util.Scanner;
 public class PrintingATable{
  public static void main(String[] args){
   
   //Calculations for each line
   double Line1= Math.pow(1, 2);
   double Line2= Math.pow(2, 3);
   double Line3= Math.pow(3, 4);
   double Line4= Math.pow(4, 5);
   double Line5= Math.pow(5, 6);
   
   //Display the table
   System.out.println("a     b         pow(a,B)/>/>");
   System.out.println("1     2         "+Line1);
   System.out.println("2     3         "+Line2);
   System.out.println("3     4         "+Line3);
   System.out.println("4     5         "+Line4);
   System.out.println("5     6         "+Line5);
   
 }
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>