Pages

Thursday, March 20, 2025

code to convert float to int in Java

 import java.util.*;


public class JavaBasics {

    // code to calculate area of a circle: area = 3.14 x radius x radius.
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        float number = sc.nextInt();
        System.out.println(number);

}
}

No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...