Java Training Feb
Java Training Feb
05/02/2023
import java.util.*;
class GoodMorning{
int n = sc.nextInt();
}
}
---------------------------
import java.util.*;
import java.util.Arrays;
class ArraysRotate{
int n = sc.nextInt();
}
arr[0] =temp;
}
}
// 3
// 3 4 5 1 2
// }
// arr[arr.length-1] =temp;
// }
// }
// }
// 3
// 4 5 1 2 3
---------------
import java.util.*;
import java.io.*;
class RightTriangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
}
}
}
5
*
**
***
****
*****
------------------
Home work
get the number , count the iterations that the number's square
import java.util.Scanner;
int n = sc.nextInt();
int count = 0 , x = 0 ;
while(n > 0) {
for(int i = 1 ; i < n ; i++){
int s = i * i ;
if( s < n){
x = s ;
}
}
n = n - x;
count++;
}
System.out.println(count);
}
-----------------------------------------------------
06/02/2024