Advertisement
Kevin321888999

Functions and function calls

Jul 18th, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3. public class Main {
  4.     public static void main(String[] args) throws IOException {
  5.      malachi();
  6.      BufferedReader BR= new BufferedReader (new InputStreamReader(System.in));
  7.      System.out.println("Give an a value: ");
  8.      int a= (int)Double.parseDouble(BR.readLine());
  9.      System.out.println("Give a b value");
  10.      int b= (int)Double.parseDouble(BR.readLine());
  11.      stranded(a,b);
  12.  
  13.     }
  14.     public static void malachi() {
  15.         System.out.println("Please type a message here: \n");
  16.         Scanner scanner = new Scanner(System.in);
  17.         String message = scanner.nextLine();
  18.     }
  19.     public static void stranded(int a, int b){
  20.         int sum=a*b;
  21.         int sum2= (int) Math.pow(a,b);
  22.         System.out.println("The product is: "+ sum);
  23.         System.out.println("a to the power of b is: " + sum2);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement