import java . util .* ; public class weekday { public static void main ( String [] args ) { Scanner sc = new Scanner ( System . in ); System . out . println ( "Enter the number" ); int n = sc . nextInt (); switch ( n ) { case 1 , 2 , 3 , 4 , 5 : { System . out . println ( "week day" ); break ;} case 6 , 7 : { System . out . println ( "week end" ); break ;} default: System . out . println ( "Invalid Day" ); } } }
import java . util .* ; public class TimezoneConvertor { public static void main ( String [] args ) { Scanner sc = new Scanner ( System . in ); // Taking user input for minute, hour, day, month, and year int min = sc . nextInt (); int hour = sc . nextInt (); int day = sc . nextInt (); int month = sc . nextInt (); int year = sc . nextInt (); // Close scanner to avoid resource leaks sc . close (); // Adjust hours and minutes for IST to GMT conversion hour = hour + 5 ; min = min + 30 ; if ( min >= 60 ) { ...
import java.util.*; class Solution { public static void main( String [] args) { // Create an instance of the Solution class Solution s= new Solution(); // Define an input array int [] nums = { 1 , 2 , 3 , 4 , 5 }; // Call the productExceptSelf method and store the result int [] result = s.productExceptSelf(nums); // Print the output array System.out.println( "Product Except Self: " ); for ( int num : result) { System.out.print(num + " " ); } } public int [] productExceptSelf( int [] nums) { ...
Comments
Post a Comment