HarrJ

Day 5 sample code

Feb 5th, 2024
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Day05A {
  4.  
  5. public static void main(String[] args) {
  6. Scanner sc = new Scanner(System.in);
  7. int num1 = 50;
  8. int num2 = 100;
  9. byte result = (byte) (num1 + num2);
  10. int result2;
  11.  
  12. System.out.println(result);
  13.  
  14. System.out.print("Enter a number: ");
  15. num1 = sc.nextInt();
  16.  
  17. result2 = num1 * num1 * num1;
  18.  
  19. System.out.println("cube of number: " + result2);
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment